FastPrepEliminate Drivers by Slowest Personal Best

Eliminate Drivers by Slowest Personal Best

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA
Learn

Problem statement

Each lap contains one name:time report for every active driver. Maintain each driver's minimum time seen.

After each lap, eliminate all active drivers tied for the highest personal-best time, appending tied names alphabetically. Return elimination order, ending with any last remaining drivers alphabetically.

Function

eliminateDrivers(laps: String[][]) → String[]

Examples

Example 1

laps = [["a:10","b:12","c:11"],["a:9","c:10"]]return = ["b","c","a"]

b is slowest after lap one, c after lap two, leaving a.

Example 2

laps = [["b:10","a:10"]]return = ["a","b"]

The tied final drivers are alphabetical.

Constraints

  • 1 <= laps.length <= 1000
  • Times are positive integers.

More ZipRecruiter problems

See ZipRecruiter hiring insights
public String[] eliminateDrivers(String[][] laps) {
    // Write your code here.
}
laps[["a:10","b:12","c:11"],["a:9","c:10"]]
expected["b", "c", "a"]
Checking account…