Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Complete Trips

Minimum Time to Complete Trips gives an array of bus trip durations and a target total. Return the least time needed for all buses to finish at least that many trips.

Statement

You are given an array of integers time, where time[i] represents the duration required for the iextthi^{ ext{th}} bus to finish a single trip.

Each bus operates independently and can undertake multiple consecutive trips, meaning a new trip starts immediately upon the completion of the previous one.

You are also given an integer totalTrips, which represents the minimum total number of trips that all buses combined must complete.

Return the minimum time required for all buses to complete at least totalTrips trips in total.

Constraints:

  • 1≤1 \leq time.length ≤105\leq 10^5

  • 1≤1 \leq time[i], totalTrips ≤107\leq 10^7

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Complete Trips

Minimum Time to Complete Trips gives an array of bus trip durations and a target total. Return the least time needed for all buses to finish at least that many trips.

Statement

You are given an array of integers time, where time[i] represents the duration required for the iextthi^{ ext{th}} bus to finish a single trip.

Each bus operates independently and can undertake multiple consecutive trips, meaning a new trip starts immediately upon the completion of the previous one.

You are also given an integer totalTrips, which represents the minimum total number of trips that all buses combined must complete.

Return the minimum time required for all buses to complete at least totalTrips trips in total.

Constraints:

  • 1≤1 \leq time.length ≤105\leq 10^5

  • 1≤1 \leq time[i], totalTrips ≤107\leq 10^7