Merge Overlapping Maintenance Windows Scheduled for Azure Hosts

Last updated: November 29, 2026

Quick Overview

Given a list of maintenance windows as [start, end] minute pairs for a fleet of Azure hosts, merge all overlapping or touching windows and return the consolidated list sorted by start.

Microsoft
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of maintenance windows as [start, end] minute pairs for a fleet of Azure hosts, merge all overlapping or touching windows and return the consolidated list sorted by start.

A foundational interval problem in Microsoft technical screens, framed around Azure planned maintenance where operators want one consolidated outage calendar. The interviewer checks sorting by start, the overlap test, and whether you clarify if touching windows merge.

What the Interviewer Expects
  • Clarify whether [1,3] and [3,5] should merge
  • Sort by start time
  • Extend the last merged window when the next one overlaps
  • Append a new window otherwise
  • State O(n log n) time dominated by sorting
Key Topics to Cover
intervals
sorting
merging
greedy
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 merge windows arriving one at a time in a live system?
  • How would you compute total covered minutes instead?
  • What if each window also carries a host set and you only merge per host?
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: list of [start, end] with start <= end, unsorted. Output: sorted list of disjoint windows covering exactly the same minutes. We confirm with the interviewer that touching windows (end equal...

High-Level Design

Sort windows by start. Walk through them keeping a result list. If the result is empty or the current window starts after the last merged window ends, it begins a new block, so append a copy. Otherwis...


Submit Your Answer
Markdown supported

Related Questions