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
Coding & Algorithms
Software Engineer
Riot Games
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

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
running minimum
single pass
arrays
match timeline
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported

Related Questions