Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

Piles of bananas are [3, 6, 7, 11] and you must finish all piles within 8 hours, eating at speed k bananas per hour (taking ceil(pile / k) hours per pile). What is the minimum integer k?

  1. A. 3
  2. B. 5
  3. C. 7
  4. D. 4

Correct answer: D. 4

At speed 4 the hours are 1 + 2 + 2 + 3 = 8, which fits. At speed 3 they are 1 + 2 + 3 + 4 = 10, which does not fit, so 4 is the minimum.

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

Exams that ask this topic