This website works better with JavaScript
Strona główna
Odkrywaj
Pomoc
Zaloguj się
ikachan
/
leetcode-go
Obserwuj
1
Polub
1
Forkuj
0
Pliki
Problemy
0
Oczekujące zmiany
0
Wiki
Drzewo:
1afcf4b246
Gałęzie
Tagi
master
leetcode-go
/
leetcode
/
easy
/
231.power-of-two.go
231.power-of-two.go
99 B
Historia
Czysty
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
}