A robot stands in the top-left cell of a grid. It wants to reach the bottom-right cell. At each step it can move only one cell down or one cell right.
The grid obstacleGrid has 0 for a free cell and 1 for a blocked cell. The robot cannot step on a blocked cell.
Return how many different paths the robot can take from the top-left to the bottom-right cell. If there is no path, return 0.
Examples
Example 1:
Input: obstacleGrid = [[0,0],[0,0]]
Output: 2
Explanation: No cell is blocked: right-down and down-right are the two paths.
Example 2:
Input: obstacleGrid = [[0,1,0],[0,0,0]]
Output: 1
Explanation: The robot must go down first, then right twice.
Example 3:
Input: obstacleGrid = [[0,0,0],[0,0,1]]
Output: 0
Explanation: The goal cell is blocked, so there is no path.