Data Structures & AlgorithmsModerateCodeforces Div2 B-D · ICPC regional
How many non-empty subsets of [1, 2, 3, 4, 5] have XOR of their elements equal to 0?
- A. 3
- B. 4
- C. 2
- D. 8
Correct answer: A. 3
Use a linear-basis insight: subsets with XOR zero are the dependencies among the values. Enumerating all 31 non-empty subsets by bitmask settles the count directly.
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
- Intervals [1,3), [2,4), [3,5), [0,6), [5,7), [8,9) may overlap only at endpoints (a touching endpoint is allowed). What is the minimum…
- Five jobs with durations [4, 3, 7, 1, 2] run one at a time on one machine. What is the minimum possible sum of waiting times (the time…
- How many index pairs i < j satisfy 3 divides a[i] + a[j] for a = [1, 2, 3, 4, 5, 6, 7]?
- How many ordered pairs (x, y) with 1 <= x, y <= 10 satisfy gcd(x, y) = 1?
- How many elements of [12, 19, 40, 7, 31, 22, 13, 8] have a decimal digit sum divisible by 4?
- How many perfect squares lie in the range [50, 250] inclusive?