115.Unique Paths II
1.Description(Easy)
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as1
and0
respectively in the grid.
Notice
m and n will be at most 100.
Example
For example, There is one obstacle in the middle of a 3x3 grid as illustrated below.
The total number of unique paths is2
.
2.Code
初始化第0行0列都只有一种走法
初始化的时候注意,若此处是1,则0行/0列后面所有的
Last updated