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?

  1. A. 3
  2. B. 1
  3. C. 2
  4. 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

Exams that ask this topic