Racing Results
Reported by candidates from Pure Storage's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Pure Storage OA reported in March 2025 opens with a crashed racing database and one job: find the champion from a pile of [race, racer, position] triples. It looks like a story problem. It's really a lookup table plus a tally. You map positions 1 through 6 to 10, 6, 4, 3, 2, 1 points, sum per racer, and pick the max. Ties go to the lowest record number. That's the whole thing. If you blank under the clock, StealthCoder runs invisibly on the screen during the live OA and gives you a working solution as a safety net.
The problem
Unfortunately, the database containing all this year's racing results has crashed. The only thing left is a backup of database records and results for each race. We urgently need to know who is the winner! Your program will receive input as a list of elements in the form of [race, racer_name, position], where all elements are integers: race is a database record number between 2001 and 2000+N where N is the total number of races in the championship. racer_name is a database record number between 1001 and 1000+R where R is the total number of racers participating. position is a value between 1 (won the race) and R (arrived last). Points are given according to the racers' position in a race: the 1st position is worth 10 points, 2nd is worth 6 points, 3rd is 4 points, 4th is 3 points, 5th is 2 points and 6th is worth 1 point. Positions further down earn no points. In case of an equal number of points at the end of the championship, the winner is the racer with the lowest record number. There are at most 100 racers, and at most 100 races in the championship. Your program is expected to output the record number of the winner, followed by how many points he or she got. Function findWinner(results: int[][]) → int[] Complete the function findWinner in the editor. findWinner has the following parameter: int[][] results: a 2D array of integers where each element is an array of the form [race, racer_name, position] Returns int[]: an array of two integers where the first element is the record number of the winner and the second element is the number of points they got Examples Example 1 results = [[2001, 1001, 3], [2001, 1002, 2], [2002, 1003, 1], [2002, 1001, 2], [2002, 1002, 3], [2001, 1003, 1]] return = [1003, 20] The two races are coded 2001 and 2002. The racers with records 1001, 1002 and 1003 competed. Based on the raw results, they have the following points: Racer 1001: 4+6=10 (3rd and 2nd positions) Racer 1002: 6+4=10 (2nd and 3rd positions) Racer 1003: 10+10=20 (1st in both races) Your program is expected to output the following line in that case: 1003 20
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is a hash map (or a plain array, since racers are 1001 to 1100) keyed by racer id, adding points per row. Points come from a fixed table: 10, 6, 4, 3, 2, 1, and zero for anything past 6th. Don't sort the whole input or group by race, you don't need to. The race number is noise. The common pitfall is the tiebreaker. When two racers have equal points, the lower record number wins, so compare points first, then id. Iterate in ascending id order and only replace the best on strictly greater points, or use an explicit tie check. Another trap is returning the points instead of [id, points], or forgetting positions beyond 6 score nothing. It's O(n) time. If your mind goes blank mid-OA, StealthCoder is the hedge that hands you this loop while you stay in the editor.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Racing Results cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Pure Storage's OA.
Pure Storage reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Racing Results FAQ
How hard is the Pure Storage Racing Results problem really?+
Easy. It's a simulation and counting problem with no clever algorithm. The only real work is building the points table and handling the tiebreaker correctly. Most people who fail it fail on the tie rule or the output format, not the logic.
What's the trick to solving Racing Results?+
Accumulate points per racer in a map or fixed-size array, ignoring the race number. Use a lookup for positions 1 to 6 and give 0 otherwise. Then scan for the maximum points, breaking ties by the smaller racer id.
How do I handle ties in the winner selection?+
Compare points first. If points are equal, pick the smaller record number. Easiest way: loop over racer ids in ascending order and only update the best when the current points are strictly greater than the best so far.
What edge cases should I test?+
Test a tie at the top, like the example where racers share 10 points. Test positions above 6 that earn nothing. Test a single race, and a racer who only appears in some races. Also confirm you return an array of [id, points], not just one value.
How do I prepare for this in 48 hours?+
Don't over-prepare. Write a hash-map tally problem with a custom tiebreak once, from scratch, and check your output format. Practice reading the statement carefully for ordering rules. This one is about attention to detail, not algorithms.