62. Unique Paths
Difficulty: Medium
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?
Above is a 3 x 7 grid. How many possible unique paths are there?
Note: _m_ and _n_ will be at most 100.
Solution
1 | class Solution { |
初始化可以用 Arrays.fill(row,1);
虽然是一个水题,但是有更优的解法,因为对称性,用一维的空间就可以
1 | class Solution { |