# Power of Three

## Des

Given an integer, write a function to determine if it is a power of three.

## Code

class Solution {
public:
bool isPowerOfThree(int n) {
while(n&&(n%3==0)) n/=3;
if(n==1){
return true;
}
else{
return false;
}
}
};

• 本文已收录于以下专栏：

## leetcode326. Power of Three

326. Power of ThreeGiven an integer, write a function to determine if it is a power of three.Follow ...

## LeetCode 326. Power of Three 解题报告

LeetCode 326. Power of Three 解题报告

## <LeetCode OJ> 326. Power of Three

326. Power of Three My Submissions Question Total Accepted: 1159 Total Submissions: 3275 Difficu...

## Leetcode 231. Power of Two & 326. Power of Three & 342. Power of Four

231. Power of Two   Total Accepted: 69528 Total Submissions: 190898 Difficulty: Easy Given an ...

## LeetCode|Power of three

LeetCode Power of Three

## leetcode- Number of 1 bits, power of two, power of three

leetcode- Number of 1 bits, power of two, power of three
• aaasy
• 2016-04-23 22:13
• 51

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)