Gas Station

gasArray
[1, 2, 3, 4, 5]
costArray
[3, 4, 5, 1, 2]
1def canCompleteCircuit(gas, cost):
2    total_tank = 0
3    current_tank = 0
4    start = 0
5
6    for i in range(len(gas)):
7        total_tank += gas[i] - cost[i]
8        current_tank += gas[i] - cost[i]
9
10        if current_tank < 0:
11            start = i + 1
12            current_tank = 0
13
14    return start if total_tank >= 0 else -1
0 / 15
gas0112233445cost34512