04.03 · Problem
Unique Paths With Obstacles
A robot moves only right or down, from the top-left cell to the bottom-right cell. Cells with 1 are walls. Count the paths. If the start or the end is a wall, the answer is 0.
Examples
Example 1
Input: grid = [[0, 0, 0],
[0, 1, 0],
[0, 0, 0]]
Output: 2
Around the obstacle either over the top (right, right, down, down) or along the left side (down, down, right, right).
solulu Pro
Continue this problem with Pro
Inside: step-by-step hints · 10 hidden tests · reference solutions · code editor.
Lifetime ₹1,999 ₹999 · Launch offer
Item 29 of 44 · updated 2026-10-13