Data Structures & AlgorithmsModerateTCS NQT Digital · CAT

Problem: The sum of the numbers in the sequence 1, 1+2, 1+2+3, …, up to 1+2+…+12 is what value?

  1. A. 78
  2. B. 286
  3. C. 650
  4. D. 364

Correct answer: D. 364

Σ T(k) for k = 1..12 is the tetrahedral number 12 · 13 · 14 / 6 = 364. 78 is the last term T(12), 286 stops at 11, and 650 sums the squares instead.

More Coding Interview Problems questions

Exams that ask this topic