Fewest Repair Actions That Clear Every Overlapping Server Outage

Last updated: November 29, 2026

Quick Overview

Each outage on a fleet is a closed time interval [start, end]. A single repair action at time t clears every outage active at t; return the minimum number of repair actions that clears all outages.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Each outage on a fleet is a closed time interval [start, end]. A single repair action at time t clears every outage active at t; return the minimum number of repair actions that clears all outages.

Google phone screens like interval problems dressed in SRE language, since on-call engineers reason about overlapping incidents constantly. The interviewer checks whether you find the sort-by-end greedy and can argue why it is optimal rather than just asserting it.

What the Interviewer Expects
  • Recognize the problem as stabbing intervals with the fewest points
  • Sort by end time and justify the exchange argument
  • Handle touching endpoints as overlapping because intervals are closed
  • Run in O(n log n) with O(1) extra space beyond sorting
  • Return the chosen times if asked, not only the count
Key Topics to Cover
Greedy
Interval scheduling
Sorting
Exchange argument
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
  • What changes if intervals are half-open [start, end)?
  • Return the actual repair times and the outages each one clears.
  • Outages arrive online in end-time order: can you answer incrementally?
  • Each repair action can only clear at most k outages. Does greedy still work?
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: a list of [start, end] pairs with start <= end, integers, possibly up to 10^5 of them. Output: the minimum count of time points such that every interval contains at least one point. Closed ...

High-Level Design

Sort outages by end time. Walk through them keeping last, the time of the most recent repair. If the current outage starts after last, no existing repair touches it, so place a new repair at its e...


Submit Your Answer
Markdown supported