Question https://www.hackerrank.com/contests/w38/challenges/atimesavingaffair Solution https://www.hackerrank.com/contests/w38/challenges/atimesavingaffair/submissions/code/1308726348 Please let me know what is wrong in this code. asked 05 Jul '18, 14:34

Your Implementation of was absolutely correct but the reason for some failing cases was the following block of code:
You are adding the extra waiting time only after you have considered that the current path is shorter than the path , What I mean to say is that you are not adding the extra waiting time before putting elements in your queue. Let us consider an example , suppose you reach a node at time t = 4 and the weight of the edge that you will be traversing is just 1 unit. Now suppose that the traffic light is red at t = 4 when you reached the node , but since you do not consider the extra waiting time during the I modified your code , check it. I just did the following modification to your code:
Since we now consider the extra waiting time in the variable tempp , It passes all the cases where it failed. I hope I was Able to help you , you can check a neat implementation of this question in c++ here. Thank You ! answered 05 Jul '18, 16:46
