# Easy
Too easy
class Solution: def isPowerOfThree(self, n: int) -> bool: while n >= 3 and n%3 == 0: n = n//3 if n == 1: return True else: return False
Last updated 4 years ago
Was this helpful?