LeetCode p62 Unique Paths 题解
1.题目:
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?
题意:
从一个n*m棋盘的左上端点走到右下端点,有多少种走法。
2.解题思路:
见代码,数学问题,每次只能选择走右或者走下。
注意数据溢出。
3.代码
1 |
|