FastPrepGet Biggest Lions
Problems/Get Biggest Lions

Get Biggest Lions

Optiver logoOptiver● MediumINTERNOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

As a lion trainer, you are taking part in an international lion exhibition. Lions from your team and competing teams enter and leave the showroom according to a schedule. You know the schedule for your lions, and during the show you observe every lion entering and leaving.

At an inspection, return your lions currently in the room whose height is at least the height of the largest competing lion currently in the room. Return qualifying names in alphabetical order. If no competing lion is in the room, every one of your lions currently in the room qualifies.

Original class behavior

  • The constructor receives descriptions of your lions and their private schedule.
  • LionEntered(currentTime, height) records one observed entry.
  • LionLeft(currentTime, height) records one observed exit.
  • getBiggestLions() returns the qualifying names for the current room state.

Your schedule is followed exactly, so an event whose time and height match a pending scheduled entry or exit identifies one of your lions. Other events belong to competitors. When several events have the same timestamp, an inspection occurs either before all of them or after all of them, never between them.

FastPrep Runner Adapter

Implement LionCompetition(String[][] lions, String[][] schedule, String[] operations).

  • Each row of lions is [name, height].
  • Each row of schedule is [name, enterTime, exitTime].
  • ENTER currentTime height calls LionEntered.
  • EXIT currentTime height calls LionLeft.
  • INSPECT currentTime calls getBiggestLions.

Return one string-array row for every INSPECT command, in operation order.

Function

LionCompetition(lions: String[][], schedule: String[][], operations: String[]) → String[][]

Examples

Example 1

lions = [["marry","300"],["rob","250"]]schedule = [["marry","10","15"],["rob","13","20"]]operations = ["ENTER 8 200","ENTER 10 310","ENTER 10 300","INSPECT 11","ENTER 13 250","EXIT 13 310","INSPECT 13","EXIT 15 300","INSPECT 16","EXIT 16 200","EXIT 20 250"]return = [[],["marry","rob"],["rob"]]

At time 11, the competing lion of height 310 is taller than both of our lions in the room, so the first row is empty. At time 13, that competitor has left and the remaining competing maximum is 200, so both marry and rob qualify. At time 16, marry has left and rob still qualifies against the competing lion of height 200.

Constraints

  • Subsequent invocations of LionLeft and LionEntered methods are always called in order, according to the currentTime parameter.
  • The schedule is strictly followed - your lions enter and exit the room exactly at their specified times.
  • The lion inspection (invocation of the getBiggestLions method) takes place either before or after all lions scheduled to enter or leave the room at a given minute did that - never in between.
  • Lion names are unique.
  • Times (currentTime, enterTime and exitTime) are always whole numbers (and multiple events can occur at the same time).
  • A single lion enters the room only once during the show.

More Optiver interview questions

  • Chance a Die Game Balance Reaches ZeroOA · Seen Dec 2026
  • Chance a Hand of Cards Multiplies to More Than a ThresholdOA · Seen Dec 2026
  • Chance a Sum of Random Draws Has a Given Number of DigitsOA · Seen Dec 2026
  • Expected Draws to Remove All Green CountersOA · Seen Dec 2026
  • Expected Profit of a Doubling Betting SystemOA · Seen Dec 2026
  • Expected Steps Until a Random Walk Gets Far From ZeroOA · Seen Dec 2026
  • Rolling Until One Face's Own Total Passes a ThresholdOA · Seen Dec 2026
  • Two Ranked Teams Meeting in a Random BracketOA · Seen Dec 2026
  • Overheat Prevention ControllerOA · Seen Nov 2026
  • Power Cell BankOA · Seen Nov 2026

Similar questions at other companies

  • Expiring Authentication Token ManagerIBM · OAIBM interview questions
  • Progressive Banking SystemAirbnb · OAAirbnb interview questions
  • Weighted LFU CacheIMC Trading · OAIMC Trading interview questions
  • Weighted LFU CacheMicrosoft · OAMicrosoft interview questions
  • Find Median from Data StreamIntuit · OAIntuit interview questions
  • Cloud Compute Credits SystemCoinbase · OACoinbase interview questions
  • Product of the Maximum and Minimum in a DatasetGoldman Sachs · OAGoldman Sachs interview questions
  • Priority Ad Rotation with Show LimitsAmazon · ONSITE INTERVIEW
  • Fixed Window Average and ModeNuro · PHONE SCREENNuro interview questions
  • Paged KV Cache AccessNVIDIA · PHONE SCREENNVIDIA interview questions

Optiver interview experiences

  • Optiver SWE Intern OA: CPU Temperature Simulation: 1 Experience
  • Optiver Trading Intern Market-Making Games: 1 Experience
  • Optiver Quant Trader Intern Technical Interview: 1 Experience
  • Optiver SWE Intern System Design Interview: 15 Experiences
All Optiver interview questionsSee Optiver hiring insights
Saved
class Solution {
    public String[][] LionCompetition(String[][] lions, String[][] schedule, String[] operations) {
      // write your code here
    }

}
Checking account…