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?
左上角到右下角,每次走下和右方向,求一共有多少的走法。
代码:
参考代码
解题思路:动态规划,定义二维数组v,从左上角开始,计算每一个值,最后返回 v[m-1][n-1],即可。