https://www.hackerearth.com/practice/algorithms/graphs/shortest-path-algorithms/practice-problems/algorithm/mancunian-goes-to-the-derby/description/ I am facing it tough to understand the editorial of this problem . I know it'll sound really simple for most of you . So can someone please explain the editorial to me , or tell me their own way of going about this problem. Any help is appreciated :)
You can use bfs to get minimal time you need to reach point N. Code
I am the setter of this problem. What did you not understand in the editorial? The crux is that the direction of each edge depends on the parity (odd or even) of the current time. So, for each vertex, we create two nodes to consider both cases. If you could perhaps explain in some more detail exactly the part which is unclear, maybe I could help. :)