Quiz: Bitmask Subsets

Test your understanding

Check Your Understanding

To iterate all subsets of a bitmask mm, you use: s=ms = m; while s>0s > 0: process(ss); s=(s1)&ms = (s-1) \& m. Why does this work?

  1. A.It generates numbers in decreasing order
  2. B.It uses binary counting
  3. C.s1s-1 is always a subset of mm
  4. D.(s1)&m(s-1) \& m gives the next smaller subset of mm
Start the roadmap to answer the quizzes and solve the challenges