FastPrepMarathon Checkpoint Leaderboard
Problems/Marathon Checkpoint Leaderboard

Marathon Checkpoint Leaderboard

Bloomberg LP logoBloomberg LP● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for a marathon leaderboard with checkpoints 0 through m-1 and players 0 through n-1. It says a hash map keyed by checkpoint was proposed, a player list backed by an array was rejected as too slow, and a linked list was the intended improvement. We made the progress buckets it hints at into working code. PASS moves a player to the next checkpoint in constant time. Players at the same checkpoint stay in the order they arrived. TOP walks the checkpoints from front to back.

Given sensorCount, playerCount, and operations, return the requested leaderboard rows for a marathon.

There are sensorCount checkpoints numbered from 0 to sensorCount - 1. There are playerCount runners numbered from 0 to playerCount - 1.

Every runner starts at checkpoint -1, before all checkpoints. Initially, runners are ranked by increasing runner ID.

Process operations in order:

  • ["PASS", player, sensor] records player reaching checkpoint sensor. This must be the runner's next checkpoint, exactly one greater than their current checkpoint.
  • ["TOP", k] requests the first k runners. Rank runners by checkpoint, with larger checkpoints first. At the same checkpoint, the runner who arrived earlier comes first.

For each TOP operation, return a row of "player|checkpoint" entries in rank order. Each entry gives the runner ID and their current checkpoint, separated by a vertical bar. Return the rows in the order of the queries.

Function

marathonLeaderboard(sensorCount: int, playerCount: int, operations: String[][]) → String[][]

Examples

Example 1

sensorCount = 3playerCount = 4operations = [["PASS","2","0"],["PASS","0","0"],["TOP","4"],["PASS","0","1"],["TOP","3"]]return = [["2|0","0|0","1|-1","3|-1"],["0|1","2|0","1|-1"]]

Runner 2 reaches checkpoint 0 before runner 0, so they lead the first query in that order. After runner 0 reaches checkpoint 1, runner 0 leads the next query.

Example 2

sensorCount = 2playerCount = 3operations = [["TOP","2"],["PASS","1","0"],["PASS","2","0"],["PASS","1","1"],["TOP","3"]]return = [["0|-1","1|-1"],["1|1","2|0","0|-1"]]

With no passes recorded, the first query lists runners by ID. At the last query, runner 1 leads runner 2, followed by runner 0, who has not passed a checkpoint.

Example 3

sensorCount = 1playerCount = 2operations = [["PASS","1","0"],["PASS","0","0"],["TOP","1"]]return = [["1|0"]]

Both runners have reached the finish sensor, and runner 1 arrived first.

Constraints

  • 1 <= sensorCount, playerCount <= 100000.
  • 1 <= operations.length <= 100000.
  • Every operation is PASS or TOP.
  • Each PASS uses a valid runner and that runner's next checkpoint.
  • 1 <= k <= playerCount for every TOP.
  • At least one TOP operation is present.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • LRU CacheApple · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
  • Least Recently Used CacheMicrosoft · OA · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
  • LRU CacheAMD · ONSITE INTERVIEWAMD interview questions
  • Least Recently Used CacheByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • LRU Cache with Hit and Miss CountersLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Least Recently Used CacheGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • LRU CacheIntuit · ONSITE INTERVIEWIntuit interview questions
  • LRU CacheOracle · ONSITE INTERVIEWOracle interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public String[][] marathonLeaderboard(int sensorCount, int playerCount, String[][] operations) {
        // Write your code here.
    }

}
Checking account…