Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

What is the smallest positive integer m such that the sum of ceil(a_i / m) over a = [7, 11, 12] is at most 9?

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

Correct answer: D. 4

The sum of ceilings is non-increasing in m, so the first feasible m is found by binary search or a linear scan. Using floor division instead of ceiling changes the answer.

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

Exams that ask this topic