Data Structures & AlgorithmsHardProduct Company SDE · lattice paths

Problem: How many monotone (right and up) lattice paths from (0,0) to (5,7) pass through the point (2,3)? Run the code.

Problem: How many monotone (right and up) lattice paths from (0,0) to (5,7) pass through the point (2,3)? Run the code.
from math import comb
print(comb(5, 2) * comb(7, 3))
What is printed?
  1. A. 210
  2. B. 420
  3. C. 126
  4. D. 350

Correct answer: D. 350

C(5,2) = 10 paths reach (2,3) and C(7,3) = 35 paths continue to (5,7), giving 10 * 35 = 350.

More Coding Interview Problems questions

Exams that ask this topic