Quiz: Brian Kernighan

Test your understanding

Check Your Understanding

Brian Kernighan's algorithm counts set bits using n=n&(n1)n = n \& (n-1). Why does this work?

  1. A.It shifts bits right
  2. B.n&(n1)n \& (n-1) clears the lowest set bit
  3. C.It toggles all bits
  4. D.It doubles the number
Start the roadmap to answer the quizzes and solve the challenges