$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · easy · #321

What goes in the blank?

# is n a power of two? (one bit set)
ok = n > 0 and (n & (n - 1)) == ____

Answer: 0 (also accepted: 0)

n - 1 flips the lowest set bit and the zeros below it; if that was the only bit, the AND is 0.
Play Problem Solving ▸