Doubt in the Example Provided


#1

If only the question is, return the minimum starting gas station’s index if you can travel around the circuit once ?

Why not the answer is 0 ?

As we can go from 0 to 1 with cost of 2 and refill at 1 with cost of 1 and 2 units of gas . Yes, when we will return to 0 following this path we will have 1 unit of gas left or unused but we are able to travel around the circuit once.

So, are we indirectly asked to minimize the gas usage as well ?

Because in the example mentioned above, it is guaranteed that we will return to 0 if we start from 0 but yes 1 unit of gas will remain unused.


#2

You cannot go from Station 1 to Station 2 because cost is 2 for going to station 2, but you have only 1 unit gas available at station 1.