Data Structures & AlgorithmsModerateSSC CGL Tier 2 · TCS NQT
Problem: How many positive divisors does 720 have?
- A. 30
- B. 8
- C. 29
- D. 15
Correct answer: A. 30
720 = 2⁴ · 3² · 5, so the divisor count is (4 + 1)(2 + 1)(1 + 1) = 30. Multiplying the exponents without adding 1 gives 8, leaving out 720 itself gives 29, and counting divisor pairs d · (720 / d) gives 15.
More Coding Interview Problems questions
- Problem: Find the modular inverse of 7 modulo 26 (the value x with 0 ≤ x < 26 such that 7x ≡ 1 mod 26).
- Problem: A Gray code of 4 bits is generated as g = n XOR (n >> 1) for n = 0 to 15. What is the Gray code value of n = 11?
- Problem: The sum of the digits of 2^100 written in base 10 is computed. What is that sum?
- Problem: In a spiral traversal of a 5×5 matrix filled row-wise with 1 to 25, the traversal starts at the top-left and goes right, then…
- Problem: A bitmask DP problem: count the subsets of {1, 2, ..., 10} whose sum is a multiple of 5 (the empty set counts, since its sum 0 is…
- Problem: An 8-bit unsigned counter starts at 250 and is incremented by 7 each step, wrapping modulo 256. How many increments until the…