Minimum Time to Complete Trips LeetCode solution in Python
1class Solution(object):2def minimumTime(self, time, totalTrips):3anstillnow = -14left = 15right = 10000000000000167while left <= right:8mid = (9left + (right - left) / 210) # find mid point like this to avoid overflow1112curr_trips = 01314for t in time:15curr_trips += mid / t1617if curr_trips >= totalTrips:18anstillnow = mid19right = mid - 12021else:22left = mid + 12324return anstillnow