This website works better with JavaScript
Sākums
Izpētīt
Palīdzība
Pierakstīties
ikachan
/
leetcode-go
Vērot
1
Pievienot zvaigznīti
1
Atdalīts
0
Faili
Problēmas
0
Izmaiņu pieprasījumi
0
Vikivietne
Koks:
514ec075d8
Atzari
Tagi
master
leetcode-go
/
leetcode
/
easy
/
231.power-of-two.go
231.power-of-two.go
99 B
Vēsture
Neapstrādāts
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
}