Data Structures & AlgorithmsHardProduct company OA · Amazon/Microsoft-style OA

How many non-empty subsets of {1, 2, 3, 4, 5, 6} have an XOR of their elements that is at least 4?

  1. A. 35
  2. B. 32
  3. C. 30
  4. D. 31

Correct answer: B. 32

Count with a bit DP over the achievable XOR values, adding one element at a time, then sum the counts for values 4 to 7. Including the empty subset, whose XOR is 0, does not change this total, but misreading 'at least' as 'greater than' does.

More Coding Interview Problems questions

Exams that ask this topic