Question bank › Graphs Bfs
Dsa Graphs Bfs Medium

City Path Planning

You are given a grid representing a city map where '0's represent traversable roads and '1's represent obstacles. Find the shortest path from the top-left corner to the bottom-right corner. You can only move right, down, left, or up. Return the length of the path. If a path does not exist, return -1. Example: Input: 4 4 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 0 Output: 6

Key concepts

bfsshortest pathgrid

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.