Getting tle even after using visited 2d array


#1

I m changing the status of the visited cell just after pushing it in queue.still on submission
this case shows TLE. my solution is in c++. any idea ?
A : 2
B : 20
C : 1
D : 18
E : 1
F : 5


#2

There’s a possibility that you are not marking the nodes visited at the right place.