Data Structures & AlgorithmsVery hardICPC regional · bitmask DP
Problem: Which technique computes the sum of a function over all subsets of a set of size n in O(n 2^n)?
- A. Floyd-Warshall
- B. Prim's algorithm
- C. Binary search
- D. Subset-sum-over-subsets (SOS) DP
Correct answer: D. Subset-sum-over-subsets (SOS) DP
SOS DP updates one bit at a time, giving O(n 2^n) for sums over submasks.
More Coding Interview Problems questions
- Problem: What does the cross product of two 2D vectors (a, b) and (c, d) equal?
- Problem: Which approach finds the k-th lexicographically smallest substring of a string?
- Problem: What is the expected number of distinct values when n balls are thrown uniformly into n bins?
- Problem: Which algorithm is the standard way to find the minimum number of swaps to sort a permutation?
- Problem: What is the complexity of binary exponentiation for computing a^b mod m?
- Problem: What property of an array makes the two-pointer technique for pair sums valid?