FreeCareerPath
Build the PrimitiveMedium

Unique Paths

Write `unique_paths(m, n)` counting the routes from the top-left to the bottom-right of an m x n grid moving only right or down. unique_paths(3, 7) -> 28 Each cell is the sum of the cell above and the cell to its left. The full table is O(m*n) space; one rolling row is O(n). Worth naming: the answer is also the binomial coefficient C(m+n-2, m-1), since every path is a fixed multiset of moves.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Unique Paths" are saved to your account — logging in takes a few seconds.

Unique Paths — FreeCareerPath