263. 丑数 1.题目 2.官方的解决方案 我写的是递归,感觉low了 class Solution: def isUgly(self, n: int) -> bool: if n <= 0: return False while n%2 == 0: n //= 2 while n%3 == 0: n //= 3 while n%5 == 0: n //= 5 return n == 1 时间复杂度: O ( l o g n ) O(logn) O(logn)空间复杂度: O ( 1 ) O(1) O(1)