Data Structures & AlgorithmsModerateTCS NQT · SSC CGL Tier 2

Problem: The sum of the squares of the odd numbers from 1 to 19 is what value?

  1. A. 1330
  2. B. 2470
  3. C. 1540
  4. D. 100

Correct answer: A. 1330

n(2n − 1)(2n + 1)/3 with n = 10 gives 10 · 19 · 21 / 3 = 1330. All squares 1..19 give 2470, the even squares up to 20² give 1540, and 100 is the sum of the odd numbers themselves.

More Coding Interview Problems questions

Exams that ask this topic