Data Structures & AlgorithmsHardICPC regional · Codeforces Div2 B
Problem: How many subsets (including the empty set) of [1, 2, 3, 4, 5] have bitwise XOR equal to 0?
- A. 5
- B. 4
- C. 3
- D. 6
Correct answer: B. 4
Enumerate all 32 subsets and check the XOR of each. The empty set has XOR zero and is included, which matters for the total.
More Coding Interview Problems questions
- Problem: How many integers from 1 to 100 are divisible by exactly one of 2 and 3?
- Problem: What is the last non-zero decimal digit of 10! (3628800)?
- Problem: Five people (including Alice and Bob) stand in a row. In how many arrangements do Alice and Bob stand next to each other?
- Problem: The array [3, 1, 2] undergoes one pass of bubble sort (compare each adjacent pair from left to right and swap if out of order)…
- Problem: In the array [2, 9, 4, 7, 1, 8], find the 4th smallest element using the quickselect idea (its final answer is the value that…
- Problem: In the sorted array [1, 2, 4, 7, 8, 11, 13], how many pairs (i, j) with i < j have a[j] − a[i] ≤ 2?