Poison

326. Power of Three

1
2
3
4
5
6
7
8
9
class Solution {
public boolean isPowerOfThree(int n) {
if (n <= 0) {
return false;
}

return 1162261467 % n == 0;
}
}
Reference

326. Power of Three