← 返回 meta 的题目列表Count All Unique Paths in a Grid with Obstacles
类型:online_judge
Given a m x n grid of integers representing a grid with obstacles, where some cells contain barriers, find the number of unique paths from the top-left corner to the bottom-right corner. You can only move either right or down at any point in time.
Input:
A 2D integer array grid, where grid[i][j] == 0 indicates an empty cell and grid[i][j] == 1 indicates an obstacle.
Output:
An integer representing the number of unique paths from the top-left to the bottom-right corner.
Example:
Input: grid = [[0,0,0],[0,1,0],[0,0,0]]
Output: 2
Explanation: There are two paths: [Right->Right->Down->Down] and [Down->Down->Right->Right]
Constraints: 1 <= m, n <= 100
Example
Input
[[0,0,0],[0,1,0],[0,0,0]]