Leet-Code 326. Power of Three: Question Link: https://leetcode.com/problems/power-of-three/description/
My Code:
class Solution:
def isPowerOfThree(self, n: int) -> bool:
print(n)
if n % 3 == 0:
if n == 3:
return True
return self.isPowerOfThree(n/3)
else: return False
I a getting the following error. Any help!
RecursionError: maximum recursion depth exceeded while getting the str of an object