Question bank › Dynamic Programming
Dsa Dynamic Programming Medium

Unique Path Grid

You are given a grid with m rows and n columns, where some cells are blocked. You can only move down or right at any point in time. Write a function that calculates the number of unique paths from the top-left corner to the bottom-right corner of the grid, while avoiding the blocked cells. Input Format: - The first line contains integers m and n (1 ≤ m, n ≤ 100). - The following m lines contain n integers, where 0 means an empty cell and 1 means a blocked cell. Output Format: - Output the number of unique paths from the top-left to the bottom-right corner of the grid. Example: Input: 3 3 0 0 0 0 1 0 0 0 0 Output: 2

Key concepts

dynamic_programminggridpathfinding

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.