[Leetcode]263. Ugly Number
263. Ugly Number
- 本题难度: Easy
- Topic: Data Structure
Description
我的代码
class Solution:
def isUgly(self, num: 'int') -> 'bool':
if num == 0:
return False
if num == 1:
return True
return self.dividePrime(self.dividePrime(self.dividePrime(num,2),3),5) == 1
def dividePrime(self,num,prime):
while(num%prime==0):
num //= prime
return num