Question 62 Unique Path

The description of the question is in the following link:

My Code:

    def uniquePaths(self, m: int, n: int) -> int:
        Mat = [[1] * n for _ in range(m)]

        for col in range(1, m):
            for row in range(1, n):
                Mat[col][row] = Mat[col - 1][row] + Mat[col][row - 1];

        return d[m - 1][n - 1];

Explain: Starting From the very beginning and go one by one. Each step is generated from the sum of the step number above it and left to it.

 

Leave a comment