Skip to content

Practice Minimum Time to Transport All Individuals

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

Hard#3594
LeetCode Problem

Minimum Time to Transport All Individuals

Problem Statement

Transport n people across a river using a boat carrying at most k people. Conditions cycle through m stages, beginning at stage 0. A departing group takes the largest time[i] among its members multiplied by mul[currentStage]. After a crossing lasting d, advance the stage by floor(d) modulo m. If anyone remains at the starting bank, one person on the destination bank must return the boat; their return takes time[i] multiplied by the then-current multiplier and advances the stage by the same rule. Return the minimum total time to move everyone to the destination, or -1 if impossible.

Source: Minimum Time to Transport All Individuals on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 1, k = 1, m = 2, time = [5], mul = [1.0,1.3]
Output
5.00000

# Example 2

Input
n = 3, k = 2, m = 3, time = [2,5,8], mul = [1.0,1.5,0.75]
Output
14.50000

# Example 3

Input
n = 2, k = 1, m = 2, time = [10,10], mul = [2.0,2.0]
Output
-1.00000

Constraints

1 <= n == time.length <= 12
1 <= k <= 5
1 <= m <= 5
1 <= time[i] <= 100
m == mul.length
0.5 <= mul[i] <= 2.0

Related LeetCode Problems

Practice more problems similar to Minimum Time to Transport All Individuals.

Review your practice with PhantomCodeAI

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