Data Structures & AlgorithmsVery hard

For sorted positive integers, the smallest value that cannot be formed as a subset sum equals R+1, where R is the reach. Why does a value a > R+1 stop the reach?

  1. A. Because a > R+1 cannot be formed from earlier values, and every later value is at least a, so R+1 stays unreachable.
  2. B. Because the sum of the array becomes odd at that point.
  3. C. Because positive integers cannot exceed R in a sorted list.
  4. D. Because the reach is reset to zero whenever a value is skipped.

Correct answer: A. Because a > R+1 cannot be formed from earlier values, and every later value is at least a, so R+1 stays unreachable.

Values before a sum to at most R, so R+1 cannot be built from them; the later values are all at least a > R+1, so they cannot help either. Hence R+1 is the smallest unreachable subset sum.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic