Marks :10
: 1 | : 0
Given a grid with N rows and M columns, consisting of the following symbols:
You cannot travel through obstacles, and consider only the cells sharing an edge to be adjacent. (4 - adjacency)
Please tell if there exists a path from 'S' to 'E' following the above conditions.
First line contains 2 space separated integers N (1 <= N <= 1e5) and M (1 <= M <= 1e5), N*M <= 1e6.
Next N lines contains string of M length consisting of characters '#', '.', 'S' and 'E'.
There exists exactly one 'S' and 'E' in the grid.
Output "YES" if the path exists, "NO" if the path doesn't exist.
5 5 #..#. S#..# ....# #.#E# #####
YES
5 5 #..#. S#..# ...## #.#E# #####
NO
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.