326. Power of Three
Input:
27
Output:
trueInput:
0
Output:
falseInput:
9
Output:
trueLast updated
Was this helpful?
Input:
27
Output:
trueInput:
0
Output:
falseInput:
9
Output:
trueLast updated
Was this helpful?
Was this helpful?
Input:
45
Output:
falseclass Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and pow(3,19,n)== 0