Skip to content

Commit 6746c38

Browse files
committed
Time: 1 ms (95.81%), Space: 17.9 MB (25.52%) - LeetHub
1 parent ebdf108 commit 6746c38

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def isPowerOfThree(self, n: int) -> bool:
3+
if n <= 0:
4+
return False
5+
if n == 1:
6+
return True
7+
if n % 3 != 0:
8+
return False
9+
return self.isPowerOfThree(n // 3)

0 commit comments

Comments
 (0)