Example 1
- Input
- gas = [1,2,3,4,5], cost = [3,4,5,1,2]
- Output
- 3
Starting at 3, the tank after each outgoing leg is 3, 6, 4, 2, 0 along the station order 3, 4, 0, 1, 2. All five legs are affordable, including the last leg back to 3. Starts 0, 1, and 2 fail immediately; start 4 reaches a negative tank at station 2.