Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

How many distinct values does floor(30 / k) take as k ranges over 1 to 30?

  1. A. 11
  2. B. 10
  3. C. 12
  4. D. 14

Correct answer: B. 10

The values of floor(n/k) take only about 2 sqrt(n) distinct values, which is why blocks of equal quotients can be summed quickly.

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

Exams that ask this topic