Dsa
Graphs Dfs
Warm-up
Maze Runner
You are given a maze represented by a 2D list of '0's (paths) and '1's (walls). The task is to determine whether there is a path from the top-left corner (0, 0) to the bottom-right corner (n-1, m-1). The program reads the maze dimensions n and m, followed by n rows of the maze. Output 'YES' if a path exists, otherwise output 'NO'.
Example:
Input:
4 4
0 1 0 0
0 1 0 1
0 0 0 1
1 1 0 0
Output:
YES
Key concepts
graphsdfsmaze
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