why do we have used continue statements in the 2nd part of the code when we are on last station and want to go to the town
Expedition code
at 13:25 and next portions of the code from this point in the video
@aslesha.j7
We set flag to 1 in line 54
Reason for it is given in line 52
It is a case where you run out of fuel before reaching a station
So travel is not possible
So we break the loop
And now since flag is 1 we print -1 which tells that it is not possible to reach end
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.