Dsa
Graphs Dfs
Medium
Path Finder in a Maze
Given a 2D grid that represents a maze, where '1' represents open paths and '0' represents walls, determine if there is a path from the top-left corner of the maze to the bottom-right corner. You can only move horizontally or vertically (not diagonally). Return 'YES' if a path exists, otherwise return 'NO'.
Input Format:
- The first line contains two integers m and n (1 <= m, n <= 100).
- The next m lines contain n characters each, either '0' or '1'.
Output Format:
- A string 'YES' or 'NO'.
Example:
Input:
3 3
101
111
001
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