Data Structures & AlgorithmsModerateTCS NQT · number theory
Problem: How many positive divisors does 2^4 * 3^2 * 5 * 7 have?
- A. 60
- B. 45
- C. 90
- D. 120
Correct answer: A. 60
The divisor count is the product of (exponent + 1), giving 5 * 3 * 2 * 2 = 60. The trap 120 comes from using the exponents themselves instead of exponent + 1 for the 5 and 7 factors.
More Coding Interview Problems questions
- Problem: Minimum insertions of brackets to make the string '(()))(' valid, found by this greedy scan? python s = '(()))(' bal = 0 ins = 0…
- Problem: How many contiguous subarrays of [1, 2, 1, 2, 1, 3, 1] contain exactly 2 odd numbers? python a = [1, 2, 1, 2, 1, 3, 1] k = 2 cnt…
- Problem: How many subsets of {1, 2, 3, 4, 5, 6, 7, 8} have a sum of exactly 10? python cnt = 0 for m in range(1 << 8): if sum(i + 1 for i…
- Problem: After running Floyd-Warshall on a directed graph with possibly negative edges, which check correctly detects that vertex i lies…
- Problem: A road graph has V = 10^5 vertices and E = 3 10^5 edges, all weights non-negative, and you need shortest paths from one source…
- Problem: For the shortest subarray with sum at least S in an array of positive integers, a two-pointer sweep is used: extend the right…