62. Finding Unique Path

Problem

Intuition

Since we are supposed to find all the unique paths, it means we need to explore all the paths that are available. As we are using a top down approach, we try to move from end to the start exploring all the possible moves.

Recursive solution

Recursive Tree

Here we can see the recursive tree gets big quickly. So we need to optimise it

Memoization

We are using grid as the cache to store the computation results. Then the recursive call graph looks like this

Tabulation

In the population method we try to build the solution from bottom to top that is from start to the end period.

Last updated