mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
Time: 87 ms (64.27%), Space: 13.8 MB (95.22%) - LeetHub
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class Solution:
|
||||
def isPowerOfThree(self, n: int) -> bool:
|
||||
if n < 1:
|
||||
return False
|
||||
|
||||
if n == 1:
|
||||
return True
|
||||
|
||||
if n % 3 == 0:
|
||||
return self.isPowerOfThree(n / 3)
|
||||
return False
|
||||
Reference in New Issue
Block a user