Data Structures & AlgorithmsModerateTCS NQT · Infosys
Problem: What is the sum of the divisors of 360 that are perfect squares?
- A. 14
- B. 1170
- C. 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
- Problem: How many integers from 1 to 200 are both perfect squares and perfect cubes?
- Problem: Compute 7^2024 modulo 9.
- Problem: What is the multiplicative inverse of 3 modulo 11 (the value x with 0 ≤ x < 11 and 3x ≡ 1 mod 11)?
- Problem: The k = 2 closest points to the origin are chosen from the list (1,3), (−2,2), (5,8), (0,1). Compute the sum of the squared…
- Problem: Intervals [1,4], [3,7] and [6,10] are available. What is the minimum number of these intervals needed to cover the whole segment…
- Problem: Starting from x = 7, apply six times the rule: if x is even, x = x/2 (integer), otherwise x = 2x + 3. What is the final value of x?