这考的是数学基础
class Solution {
public boolean isPowerOfThree(int n) {
if(n <= 0) {
return false;
}
while( n % 3 == 0 ) {
n = n / 3;
}
return n == 1;
}
}
这考的是数学基础
class Solution {
public boolean isPowerOfThree(int n) {
if(n <= 0) {
return false;
}
while( n % 3 == 0 ) {
n = n / 3;
}
return n == 1;
}
}
让时间为你证明