Power of Three
Given an integer, write a function to determine if it is a power of three.
Example
Input: 27
Output: true
Input: 45
Output: false
Solution
class Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and 1162261467 % n == 0