Data Structures & AlgorithmsModerateGATE CS · TCS NQT

What is the smallest non-negative integer x for which x³ + x is at least 1000?

  1. A. 9
  2. B. 10
  3. C. 32
  4. D. 500

Correct answer: B. 10

x³ + x is strictly increasing, so binary search finds the first x with the predicate true: 9³ + 9 = 738 fails and 10³ + 10 = 1010 passes. Reading the expression as x² + x gives 32, as x + x gives 500, and 9 is the last failing value.

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

Exams that ask this topic