Data Structures & AlgorithmsHardGATE CS · ICPC regional

What is the minimum possible value of the largest sum among the two groups when the array [7, 2, 5, 10, 8] is split into two contiguous groups (the split point may be anywhere, one group may not be empty)?

  1. A. 18
  2. B. 20
  3. C. 15
  4. D. 22

Correct answer: A. 18

Binary search on the answer with a greedy feasibility check, or try each split point. Splitting by equal element counts is not the same as balancing sums.

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

Exams that ask this topic