You are viewing a single comment's thread. Return to all comments →
Python 3
N = len(petrolpumps) pos = fuel = 0 for i in range(N): fuel += petrolpumps[i][0]- petrolpumps[i][1] if fuel < 0: pos = i + 1 fuel = 0 return pos
Seems like cookies are disabled on this browser, please enable them to open this website
Truck Tour
You are viewing a single comment's thread. Return to all comments →
Python 3