Data Structures & AlgorithmsHardCodeforces Div2 D · ICPC regional
For the list [3, 5, 6, 9, 10], how many subsets (including the empty subset) have a bitwise XOR of exactly 0?
- A. 3
- B. 32
- C. 6
- D. 4
Correct answer: D. 4
Bitmask-style DP over the list keeps, for each XOR value, the number of subsets that produce it. Forgetting that the empty subset has XOR 0 gives one fewer, and counting all 2ⁿ subsets ignores the XOR condition.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many subsets of the set {1, 2, ..., 10} (the empty set included) contain no two consecutive integers?
- In how many ways can 6 distinct people be divided into 3 unordered pairs (every person is in exactly one pair, and the pairs are not…
- Items are given as (weight1, weight2, value): [(2, 3, 4), (3, 4, 5), (4, 6, 2), (1, 1, 1), (5, 7, 8)]. Each item can be used once. You…
- How many ways can the six numbers [1, 2, 3, 4, 5, 6] be assigned to three labelled groups (group A, group B, group C), each number going…
- From the numbers [1, 2, 3, 5, 6, 8, 9, 10], what is the size of the largest subset in which any two chosen numbers differ by at least 2?
- Starting at index 0 of the array [4, 8, 5, 2, 25], repeatedly jump to the next strictly greater element (a monotonic stack gives these…