← All problems

Unique Paths with Obstacles

Medium dynamic programmingmatrix LeetCode ↗
Count paths from top-left to bottom-right moving only down/right, avoiding obstacles.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(mn), Space O(1) in-place

Common pitfalls

  • Not zeroing obstacle cells
  • Forgetting blocked start/end

Your solution

Log in to save your code and track progress.