190, 3379, 693

This commit is contained in:
2026-02-20 00:37:14 +08:00
parent 68a402077a
commit e1e872380e
2 changed files with 22 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
package A
func hasAlternatingBits(n int) bool {
n = n ^ (n >> 1)
return n&(n+1) == 0
}