Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

A conveyor must ship packages with weights 1, 2, 3, ..., 10 in the given order, in at most 5 days, and loads cannot be reordered. What is the minimum ship capacity needed?

  1. A. 14
  2. B. 10
  3. C. 17
  4. D. 15

Correct answer: D. 15

Binary search the capacity between max weight and total weight, and test feasibility greedily. Capacity 15 needs exactly 5 days; capacity 14 needs 6, so 15 is the minimum.

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

Exams that ask this topic