Unique Paths II — C++ Coding Problem
Difficulty: medium | Category: dynamic-programming
Problem Description
A robot is located at the top-left corner of an `m x n` grid. The robot can only move right or down. Some cells contain obstacles (marked as `1`). Return the number of unique paths from top-left to bottom-right. **Constraint:** `obstacleGrid[i][j]` is 0 or 1.
Examples
Example 1
Input: obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]
Output: 2
Example 2
Input: obstacleGrid = [[0,1],[0,0]]
Output: 1