Skip to content

Practice Minimum Time to Complete Trips

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2187
LeetCode Problem

Minimum Time to Complete Trips

Problem Statement

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.

Source: Minimum Time to Complete Trips on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
time = [1,2,3], totalTrips = 5
Output
3

# Example 2

Input
time = [2], totalTrips = 1
Output
2

Constraints

1 <= time.length <= 10^5
1 <= time[i], totalTrips <= 10^7

Related LeetCode Problems

Practice more problems similar to Minimum Time to Complete Trips.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.