Data Structures & AlgorithmsHardTCS NQT · Product Company SDE
Problem: The grid 2×3 contains the values [[1,2,3],[4,5,6]]. From the top-left cell you move right or down to the bottom-right, collecting values along the way (start and end included). How many distinct paths yield a total of exactly 12?
- A. 1
- B. 2
- C. 0
- D. 3
Correct answer: A. 1
There are C(3,1) = 3 monotone paths; checking each total shows which ones collect exactly 12. Counting the paths alone, without summing the values, answers a different question.
More Coding Interview Problems questions
- Problem: The sum of the digits of 2^15 is what value?
- Problem: How many subarrays of [2, 4, 1, 3, 6, 5] have an even sum? Run the code. python a = [2, 4, 1, 3, 6, 5] print(sum(1 for i in…
- Problem: How many integers x in [1, 999] satisfy x ≡ 2 (mod 3) and x ≡ 5 (mod 7)? Run the code. python print(sum(1 for x in range(1, 1000)…
- Problem: How many squares (k k with k >= 1) are at most 10^6? Run the code. python print(sum(1 for k in range(1, 10 6) if k k <= 10 6))…
- Problem: What is the maximum value of x (100 - x) over integers 0 <= x <= 100? Run the code. python print(max(x (100 - x) for x in…
- Problem: What is the number of trailing zeros in 100! expressed in base 6 (count of factors of 6)? Run the code. python n = 100 c2 = c3 =…