Given an integer, write a function to determine if it is a power of three.
思路:
可以被Int类型最大的3的倍数(3^19)整除
public class Solution {
public boolean isPowerOfThree(int n) {
return n > 0 && (1162261467 % n == 0);
}
}
更多:http://blog.csdn.net/ebowtang/article/details/50485622