Issue with expected output?


#1

Please help be better understand the required solution here.

I put the following input to the existing “See Expected Output” tool":
3 1 1 10
3 1 2 1

meaning:
Gas: [ 1, 1, 10 ]
Cost: [ 1, 2, 1]

The results shown is 2
I don’t get this.
Start at position 0: You will get to position 1 but will not have enough to travel from 1 to 2;
Start at position 1: You will not have enough gas for the first step
Start as position 2: You will have plenty of gas to complete the full circuit.

So why is the solution 2?


#2

Return the minimum starting gas station’s index if you can travel around the circuit once, otherwise return -1. Hope you get it.