Largest Gold Comeback in a League of Legends Match Timeline
Last updated: November 29, 2026
Quick Overview
Given a list of per-minute team gold differences (blue minus red) for one match, return the largest increase from an earlier minute to a later minute, along with the two minutes where it happens.
Riot Games
November 29, 20260
0
0 solved
Given a list of per-minute team gold differences (blue minus red) for one match, return the largest increase from an earlier minute to a later minute, along with the two minutes where it happens.
A warm-up in the style of a Riot phone screen, framed around the match timeline data that powers post-game graphs and esports broadcast overlays. The interviewer checks that you reach the single-pass running-minimum solution, explain it clearly, and handle matches where the trailing team never recovers.
What the Interviewer Expects
- Restate the problem as best rise from a prior minimum
- Give a single pass O(n) solution rather than checking all pairs
- Return the minute indices, not only the amount
- Handle empty input and monotonically falling timelines
- Trace a short example out loud
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you return the largest comeback for the red team at the same time?
- What if you need the top three non-overlapping comebacks?
- How would you answer this for every prefix of a live match as each minute arrives?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: gold_diff[i], blue gold minus red gold at minute i. Output: the largest value of gold_diff[j] - gold_diff[i] with i < j, plus (i, j). If blue never improves, the answer is 0 with no pair....
High-Level Design
Brute force compares every pair, O(n^2). The key observation: for each later minute j, the best start is simply the lowest value seen before j. So keep a running minimum and its index, and at each min...