class Solution: def canCompleteCircuit(self , gas , cost ): # write code here n = len(gas) a = -1 gas_New,cost_New = [],[] for i in range(n): if gas[i] >= cost[i]: gas_New = gas[i:]+gas[:i] cost_New = cost[i:]+cost[:i] curr = 0 b = 0 for j in range(n): curr += gas_New[j]-cost_New[j] if curr >= 0: b += 1 if b == n: a = i if a == -1: return -1 else: return a