classSolution(object): defnthUglyNumber(self, n): """ :type n: int :rtype: int """ # 6 star, 很巧妙的解法,多练几遍 a, b, c = 0, 0, 0 result = [1for _ in range(n)] for i in range(1, n): result[i] = min(result[a]*2, result[b]*3, result[c]*5) if result[i] == result[a]*2: a += 1 if result[i] == result[b]*3: b += 1 if result[i] == result[c] * 5: c += 1 return result[n-1]