Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Repair Cars

Try to solve the Minimum Time to Repair Cars problem.

Statement

You are given an integer array ranks representing the ranks of mechanics, where ranks[i] is the rank of the iextthi^{ ext{th}} mechanic. A mechanic with rank rr can repair nn cars in r⋅n2r \cdot n^2 minutes.

You are also given an integer cars representing the total number of cars that must be repaired.

All mechanics can repair cars simultaneously.

Return the minimum time required to repair all the cars.

Constraints:

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

  • 1≤1 \leq ranks[i] ≤100\leq 100

  • 1≤1 \leq cars ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Repair Cars

Try to solve the Minimum Time to Repair Cars problem.

Statement

You are given an integer array ranks representing the ranks of mechanics, where ranks[i] is the rank of the iextthi^{ ext{th}} mechanic. A mechanic with rank rr can repair nn cars in r⋅n2r \cdot n^2 minutes.

You are also given an integer cars representing the total number of cars that must be repaired.

All mechanics can repair cars simultaneously.

Return the minimum time required to repair all the cars.

Constraints:

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

  • 1≤1 \leq ranks[i] ≤100\leq 100

  • 1≤1 \leq cars ≤106\leq 10^6