Doubt regarding Fire Escape Routes solution

I have just started learning Graphs and tried out the problem Fire Escape Routes (FIRESC) on codechef using DFS traversal.
Can someone please point out the mistake in my code? It’s giving wrong answer.

According to the question

“The friendship is mutual. This means that if employee i is a friend of employee j then employee j is a friend of employee i as well”

So this means that the graph you need to construct should be undirected. I just made your graph undirected and it was an accepted.

1 Like

Thanks a lot, great help