Given an integer, write a function to determine if it is a power of three.
public class Solution {
public boolean isPowerOfThree(int n) {
while (n >= 3){
if(n%3 == 0){
n/=3;
}else return false;
}
return n==1 ? true : false;
}
}
1191




被折叠的 条评论
为什么被折叠?



