This website works better with JavaScript
ホーム
エクスプローラ
ヘルプ
サインイン
ikachan
/
leetcode-go
ウォッチ
1
スター
1
フォーク
0
ファイル
課題
0
プルリクエスト
0
Wiki
ツリー:
1afcf4b246
ブランチ
タグ
master
leetcode-go
/
leetcode
/
easy
/
231.power-of-two.go
231.power-of-two.go
99 B
履歴
Raw
1
2
3
4
5
6
7
8
func isPowerOfTwo(n int) bool {
if n != 0 {
for n & 1 == 0 {
n >>= 1
}
}
return n == 1
}