Given an integer n, return true if it is a power of three. Use the same technique as Power of Two but with mod 3.
Alternatively, use a logarithm trick or precompute all powers of 3 that fit in 32 bits.
(LeetCode 326)
Given an integer n, return true if it is a power of three. Use the same technique as Power of Two but with mod 3.
Alternatively, use a logarithm trick or precompute all powers of 3 that fit in 32 bits.