Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

What is the smallest positive integer x such that x(x+1)(x+2)/6 is at least 100?

  1. A. 8
  2. B. 9
  3. C. 14
  4. D. 5

Correct answer: A. 8

This is the tetrahedral number, increasing in x, so binary search finds the first x reaching 100. The check is exact because the product is divisible by 6.

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

Exams that ask this topic