Medium
,Array
,Binary Search
2187. Minimum Time to Complete Trips
You are given an array time
where time[i]
denotes the time taken by the ith bus to complete one trip.
Each bus can make multiple trips successively; that is, the next trip can start immediately after completing the current trip. Also, each bus operates independently; that is, the trips of one bus do not influence the trips of any other bus.
You are also given an integer totalTrips
, which denotes the number of trips all buses should make in total. Return the minimum time required for all buses to complete at least totalTrips
trips.
Example 1:
Example 2:
Constraints:
time.length
<= 105time[i]
, totalTrips
<= 107Yen-Chi ChenTue, Mar 7, 2023
跟吉神學習了,本來我max還不知道要設多少。
MarsgoatMar 8, 2023