FastPrepDetermine the Elimination Order (MLE)
Problems/Determine the Elimination Order (MLE)

Determine the Elimination Order (MLE)

Quora logoQuora● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Given the competition results, determine the elimination order.

The competition runs in rounds. results[r] holds the entries of round r, one per player, each written as "name time": the player's name, one space, and how long that player took in that round.

Rounds are processed in order. In each round:

  • Only players who are still in the competition count. Entries of players eliminated in an earlier round are ignored.
  • Among the players still in, the one with the longest time is eliminated and added to the output. If only one player is still in, that player has the longest time, so they are eliminated too.
  • If scores are tied, all tied contestants are eliminated simultaneously. They are added to the output in the order their entries appear in that round's list.
  • If no player is still in, the round changes nothing.

Return the names in the order the players were eliminated. Players who are never eliminated are not included.

Function

determineEliminationOrder(results: String[][]) → String[]

Complete the function determineEliminationOrder in the editor.

determineEliminationOrder has the following parameter:

  1. String[][] results: results[r] lists the "name time" entries of round r

The function returns a String[]: the names of the eliminated players, in elimination order.

Examples

Example 1

results = [["Tom 20", "Sam 10"], ["Sam 20", "Tom 10"]]return = ["Tom", "Sam"]

Round 1: Tom took 20 and Sam took 10. Tom has the longest time, so Tom is eliminated.

Round 2: Tom is already out, so his entry "Tom 10" is ignored. Only Sam remains, so Sam has the longest time among the players still in and is eliminated.

The elimination order is ["Tom", "Sam"].

Constraints

  • 1 ≤ results.length ≤ 1000
  • 1 ≤ results[r].length ≤ 100
  • Every round lists every player exactly once, in any order. So all rounds have the same names.
  • Each entry is a name, one space, and a time, such as "Tom 20".
  • A name has 1 to 10 English letters. Names are case-sensitive, and different players have different names.
  • 0 ≤ time ≤ 109, written as a plain decimal integer.

More Quora Online Assessment questions

  • Count Powers of K (MLE)OA · Seen Dec 2024

Similar questions at other companies

  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions
  • Build Sessions from Unordered Events (Part 1)Scale AI · OAScale AI interview questions
  • Temporal Key-Field Database with Prefix ScansThe Trade Desk · OA
  • HTTP Request RedirectionAmazon · OA
  • Aggregate Paginated Project Run RecordsReplit · OA
  • Eliminate Drivers by Slowest Personal BestZipRecruiter · OAZipRecruiter interview questions
  • Document and Layer OperationsFigma · OAFigma interview questions
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Power Cell BankOptiver · OAOptiver interview questions
  • Credit Accounts with Scheduled TransfersAirbnb · OAAirbnb interview questions
All Quora interview questionsSee Quora hiring insights
Saved
class Solution {
    public String[] determineEliminationOrder(String[][] results) {
      // write your code here
    }

}
Checking account…