###### 西施豆腐渣

leetcode solutions by java, c++ and python

### Power of Two

Total Accepted: 3596 Total Submissions: 11779

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

Credits:
Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.

[思路]

[CODE]

public class Solution {
public boolean isPowerOfTwo(int n) {
return n > 0 && ((n & (n - 1)) == 0 );
}
}

#### Leetcode#231_power of two

2016-04-07 21:39:28

#### LeetCode 231: Power of Two

2015-07-06 18:34:20

#### [LeetCode-231] Power of Two（判断一个数是不是2的若干次幂）

2015-09-14 19:59:45

#### leetcode 231

2016-07-21 14:09:22

#### [LeetCode 231] Power of Two

2015-09-11 13:17:08

#### 231. Power of Two [easy] (Python)

2016-05-05 14:47:26

#### leetcode 231. Power of Two 判断是否为2的幂 Java

2016-04-23 16:38:25

#### [LeetCode] Power of Three | Power of Two

2016-01-28 21:39:28

#### 随机的力量(1) - The power of random two choices

2015-11-01 00:43:52

#### leetcode 231 Power of Two C++

2016-05-23 17:10:54

## 不良信息举报

leetcode 231: Power of Two