Skip to content

Practice Minimum Time to Finish the Race

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

Hard#2188
LeetCode Problem

Minimum Time to Finish the Race

Problem Statement

Tire type i is [f,r] and takes f * r^(x - 1) seconds for its x-th consecutive lap without replacement. Start with any tire for free and complete numLaps laps. After any lap, you may spend changeTime to replace it with a fresh tire of any type, including the same type; each type has unlimited supply. Return the minimum total race time.

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

Examples

# Example 1

Input
tires = [[2,3],[3,4]], changeTime = 5, numLaps = 4
Output
21

# Example 2

Input
tires = [[1,10],[2,2],[3,4]], changeTime = 6, numLaps = 5
Output
25

Constraints

1 <= tires.length <= 10^5
tires[i].length == 2
1 <= fi, changeTime <= 10^5
2 <= ri <= 10^5
1 <= numLaps <= 1000

Related LeetCode Problems

Practice more problems similar to Minimum Time to Finish the Race.

Review your practice with PhantomCodeAI

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