Problem :

https://leetcode.com/problems/gas-station/


My Solution :

class Solution:
def canCompleteCircuit(self, gas, cost):
before = tank = start = 0
for i in range(len(gas)):
tank += (gas[i] - cost[i])
if tank < 0:
before += tank
tank = 0
start = i+1
return start if 0 <= before + tank else -1
secret