Unique Paths II Problem

Unique Paths II Problem — ExecCode Medium DSA Practice

Solve the Unique Paths II problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

A robot is on an m × n grid with obstacles marked 1. It starts at the top-left and may only move right or down. Return how many unique paths reach the bottom-right while avoiding obstacles.

Examples

Input obstacleGrid = [[0, 0, 0], [0, 1, 0], [0, 0, 0]]; Output 2. Input obstacleGrid = [[0, 1], [0, 0]]; Output 1

Constraints

1 ≤ m, n ≤ 100 obstacleGrid[i][j] is 0 or 1

Practice Unique Paths II free on ExecCode. Browse DSA problems, topic map, and placement guides.