Same as Unique paths, but cells marked 1 are obstacles that paths can't enter.
Before you code
A blocked cell has zero paths, and that zero propagates: nothing passes through it.
Hints
- If the start is blocked, the answer is 0.
- Blocked cells get 0; others get above + left.
- Watch the first row and column: once blocked, every cell after it in that row or column has 0.
Production & complexity notes
When solving Unique paths II on LeetCode (medium), always state your loop or recursion invariant before writing code. Verify how your chosen data structure behaves on degenerate inputs (single-element inputs, all-duplicate keys, strictly monotonic sequences, or maximum constraint sizes up to $10^5$ elements). In production interviews, pair your implementation with an explicit time and auxiliary space complexity proof, explain why alternative brute-force approaches violate the latency budget, and trace how cache locality and memory allocation overhead affect wall-clock throughput on real hardware. Review the step-by-step memory trace in Grids and strings to reinforce the underlying pattern.
What it practices
Grid DP with constraints, from Grids and strings.