62. Unique Paths

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],即可。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容