Data Structures & AlgorithmsHardCodeforces Div2 C · ICPC regional

Five bitmasks ['0b11', '0b110', '0b1100', '0b1001', '0b101'] are available. Choose the fewest of them whose bitwise OR equals 0b1111. What is that minimum count?

  1. A. 3
  2. B. 2
  3. C. 4
  4. D. 1

Correct answer: B. 2

Brute force over the 2⁵ subsets, or a BFS over OR-values, finds the minimum. Using AND instead of OR, or aiming only for three of the four bits, changes the answer.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic