Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

For each value n in [10, 27, 50], count the positive integers x with x^3 <= n, then add the three counts. What is the total?

  1. A. 9
  2. B. 7
  3. C. 11
  4. D. 8

Correct answer: D. 8

The count of x with x^3 <= n is the integer cube root of n, found by binary search. Here the cube roots are 2, 3 and 3, which total 8.

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

Exams that ask this topic