HTMLify
Q263_Ugly_Number.py
Views: 519 | Author: djdj
1 2 3 4 5 6 7 8 9 10 11 12 | class Solution(object): def isUgly(self, n): if n == 1: return 1 if n <=0: return 0 for num in [2,3,5]: while n % num == 0: n = n // num if n==1: return 1 return 0 |