这个掌握最基本的迭代就好。
public class Solution {
public boolean isPowerOfThree(int n) {
if (n == 0) {
return false;
}
return n == Math.pow(3, Math.round(Math.log(n)/Math.log(3)));
}
// public boolean isPowerOfThree(int n) {
// while (n > 0 && n % 3 == 0) {
// n = n/3;
// }
// return n == 1;
// }
}