Question bank › Graphs Dfs
Dsa Graphs Dfs Easy

Path Finder

You are given a maze represented as a 2D grid, consisting of '1's and '0's. '1' represents walls and '0' represents open paths. Your task is to determine if there is a valid path from the top-left corner (0,0) to the bottom-right corner (m-1,n-1) of the maze. You can only move up, down, left, or right. Input format: - The first line contains two integers, m and n, representing the number of rows and columns in the maze. - The next m lines each contain a string of length n, consisting of '0's and '1's. Output format: - Print "YES" if a path exists, otherwise "NO". Example Input: 3 3 000 010 000 Example Output: YES

Key concepts

graphsdfspathfinding

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.