Encoding June'20

Hi all,
I spent a lot of time on debugging my solution for a problem but no luck.
Here is problem link: https://www.codechef.com/problems/ECJN205

My solution link: https://www.codechef.com/viewsolution/34860531

Clear your map in your solve method and initialize your queue inside bfs rather than doing it in global space. Because you are using previous testcases values.

your changed code and AC

Thanks :slight_smile:

can we solve this using dfs , if yes then how?

Google the algorithm for shortest path in a graph using dfs.