Problem
Bus i takes time[i] minutes to complete one trip, and every bus can start its next trip immediately. All buses run at the same time, independently. Return the minimum time needed for the buses to complete at least total_trips trips in total.
Example 1
- Input
- time = [1, 2, 3], total_trips = 5
- Output
- 3
- Why
- by t = 3: 3 + 1 + 1 = 5 trips
Example 2
- Input
- time = [2], total_trips = 1
- Output
- 2
Example 3
- Input
- time = [5, 10, 10], total_trips = 9
- Output
- 25
Constraints
1 <= time.length <= 10^51 <= time[i], total_trips <= 10^7