Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

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

  1. A. 18
  2. B. 19
  3. C. 15
  4. D. 16

Correct answer: A. 18

Binary search on the answer and check greedily how many parts a cap needs. The split [7, 2, 5] and [10, 8] gives max 18, and no split does better.

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

Exams that ask this topic