deff(gas, cost):
length =len(gas)for i inrange(length):
temp = i
if gas[i]>= cost[i]:
x = gas[i]- cost[i]for _ inrange(length-1):if x <0:breakif temp >= length-1:
temp =-1
x += gas[temp+1]- cost[temp+1]
temp +=1if x >=0:return i
return-1
leetcode加油站问题def f(gas, cost): length = len(gas) for i in range(length): temp = i if gas[i] >= cost[i]: x = gas[i] - cost[i] for _ in range(length-1...