Data Structures & AlgorithmsHardProduct Company SDE · ICPC regional

Problem: Split the array [7, 2, 5, 10, 8] into 2 contiguous non-empty parts so that the largest part sum is as small as possible. What is that minimum possible largest sum?

  1. A. 16
  2. B. 23
  3. C. 14
  4. D. 18

Correct answer: D. 18

Splits give max sums 25, 23, 18, 24, so the best is [7,2,5] | [10,8] = 18. Half the total (16) is a lower bound that cannot be reached, a 2 | 3 length split gives 23, and 14 is the smaller part.

More Coding Interview Problems questions

Exams that ask this topic