GATE Computer ScienceHardGATE CS (PYQ pattern)

The array [12, 7, 9, 14, 5, 11, 8, 10, 6] must be split into 3 contiguous parts so that the largest part sum is as small as possible. What is that minimum possible largest sum?

  1. A. 28
  2. B. 30
  3. C. 27
  4. D. 33

Correct answer: B. 30

Binary search on the answer between max = 14 and total = 82, with the greedy feasibility test (start a new part when the sum would exceed the limit), gives 30: [12,7,9], [14,5,11], [8,10,6] are 28, 30, 24. The average 27.3 is only a lower bound.

More Algorithms questions

Exams that ask this topic