Data Structures & AlgorithmsHardGATE CS · TCS NQT

What is the smallest integer k such that 3k is at least every element of [5, 10, 14, 17]?

  1. A. 16
  2. B. 6
  3. C. 5
  4. D. 17

Correct answer: B. 6

Only the maximum matters: k = ⌈17/3⌉ = 6, since 3 · 6 = 18 ≥ 17. Floor division gives 5 (and 15 < 17), using the total gives ⌈46/3⌉ = 16, and 17 confuses k with the maximum itself.

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

Exams that ask this topic