1. 题目描述
2. 代码
1 class Solution: 2 def isPowerOfThree(self, n: int) -> bool: 3 while n > 2 and n % 3 == 0: 4 n = n // 3 5 return n == 1