class Solution {
public:
bool isPowerOfThree(int n) {
if(n==0)
{
return false;
}
while(n%3==0)
{
n/=3;
}
if(n!=1)
{
return false;
}
return true;
}
};
LeetCode:326. 3的幂
猜你喜欢
转载自blog.csdn.net/dosdiosas_/article/details/106294059
今日推荐
周排行