Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: What is the sum of the divisors of 360 that are perfect squares?

  1. A. 14
  2. B. 1170
  3. C. 4
  4. D. 50

Correct answer: D. 50

360 = 2³·3²·5, so square divisors use 2⁰ or 2² and 3⁰ or 3²: 1 + 4 + 9 + 36 = 50. Missing 36 gives 14, 1170 is the sum of all divisors, and 4 counts the square divisors.

More Coding Interview Problems questions

Exams that ask this topic