educative.io

Educative

Doubt over the solution

How are we able to convince that from a starting point if we reach the end, it is the only solution. why not do the whole clockwise check from an index to the same index.
I would have appended the gas and cost copies to themselves and check for an index lets say i, if we can reach i+gas.size()/2
How does greedy helped to make that check simple.

1 Like

Hello @Deepak_Mehta,

You make a valid point in asking “why not do the whole clockwise check”.

We have checked the solution text and have identified that it needs to be updated to make it more understandable. We are working on fixing the solution explanation as per your query. For the second part in your query, we are not sure how your approach works, perhaps you can check your solution in the challenge lesson of Gas Stations or even send it here.

Thank you for taking the time to provide this feedback and following up with us.

1 Like