Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div2 C
Problem: Choose a subsequence of [2, 3, 5, 7, 8] with no two chosen elements at adjacent positions. How many such non-empty choices sum to exactly 10?
- A. 3
- B. 1
- C. 2
- D. 4
Correct answer: C. 2
Enumerate subsets, reject any with adjacent indices, and count those summing to 10. Allowing adjacent picks changes the count, which is the constraint the question adds.
More Coding Interview Problems questions
- Problem: The egg-dropping puzzle with 2 eggs and a 10-floor building: what is the minimum number of drops needed in the worst case to find…
- Problem: How many ways can 10 be made using coins {1, 2, 5} where order does not matter (combinations of coin counts)?
- Problem: On a 3×3 matrix [[9,9,4],[6,6,8],[2,1,1]], a strictly increasing path moves up, down, left or right between adjacent cells with…
- Problem: The Collatz sequence starts at n = 27 and repeatedly applies: n → n/2 if n is even, n → 3n+1 if n is odd, until n = 1. How many…
- Problem: For the same Collatz process starting at n = 27, what is the largest value that appears in the sequence?
- Problem: The digital root of a positive integer is obtained by repeatedly summing its decimal digits until a single digit remains. What is…