Data Structures & AlgorithmsModerateSSC CGL Tier 2 · TCS NQT

Problem: What is the sum of the first 50 odd positive integers (1 + 3 + 5 + … + 99)?

  1. A. 4950
  2. B. 2401
  3. C. 2500
  4. D. 2550

Correct answer: C. 2500

The sum of the first n odd numbers is n², so 50² = 2500. Summing all of 1..99 gives 4950, using n = 49 gives 2401, and summing the first 50 even numbers gives 2550.

More Coding Interview Problems questions

Exams that ask this topic