You are viewing a single comment's thread. Return to all comments →
Python
def truckTour(petrolpumps): petrolRest = [pump[0]-pump[1] for pump in petrolpumps] * 2 for i in range(len(petrolpumps)): tank = 0 for j in range(i, i + len(petrolpumps)): tank += petrolRest[j] if tank < 0: break if tank < 0: continue else: return i return -1
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