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?
(不同的路径,只能向右或者向下移动从左上角移动到右下角的路径个数)
Example:
1. 动态规划
写出其动规表达式 dp[i][j] = dp[i-1][j] + dp[i][j-1] 即可,具体实现形式如下:
1 | class Solution: |