728x90
class Solution:
# @param {integer} num
# @return {boolean}
def isUgly(self, num):
if num == 0:
return False
for i in [2, 3, 5]:
while num % i == 0:
num /= i
return num == 1
728x90
'Leetcode' 카테고리의 다른 글
[LeetCode] Move Zeros 파이썬 (in-place) (0) | 2021.04.12 |
---|---|
[LeetCode] Missing Number 파이썬 (0) | 2021.04.12 |
[LeetCode] Add Digits 파이썬 (0) | 2021.04.11 |
[LeetCode] Binary Tree Paths 파이썬 (Binary Tree, LCA, DFS) (0) | 2021.04.07 |
[LeetCode] Valid Anagram 파이썬 (dict) (0) | 2021.04.07 |
댓글