题目来源:Leetcode Algorithm ProblemSet 62
题目描述:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
How many possible unique paths are there?
Note: m and n will be at most 100.
![](https://i-blog.csdnimg.cn/blog_migrate/50094216e25692a6cd6a452f938f9b72.png)
解题思路:运用动态规划,对于每一个方格grid[j][i],能到达它的只有它上面和左边的方格grid[j][i-1]和grid[j-1][i],所以它的路径数等于这两个方格路径数之和,而对于整个矩形的上左两条边的方格,路径数都为1,应先赋值。
题解代码: