Dsa
Graphs Dfs
Medium
Path to Destination
You have a maze represented as a 2D grid where 'S' is the start, 'E' is the end, '.' is a path, and '#' is a wall. Write a program to find if there exists a path from 'S' to 'E'. If a path exists, print 'Path Found'; otherwise, print 'No Path'.
Input Format:
- The first line contains two integers, M (rows) and N (columns).
- The next M lines contain the maze representation.
Output Format:
- Print 'Path Found' if a valid path exists; otherwise, 'No Path'.
Example:
Input:
4 5
S....
..###
...#E
#####
Output:
Path Found
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