Report Time Ranges Where Office License Usage Exceeds Seats

Last updated: November 29, 2026

Quick Overview

Given Microsoft 365 app sessions as [start, end) intervals and a seat cap C, return the maximal time ranges during which the number of concurrent sessions is strictly greater than C.

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

0

0

0 solved


Given Microsoft 365 app sessions as [start, end) intervals and a seat cap C, return the maximal time ranges during which the number of concurrent sessions is strictly greater than C.

A sweep line problem in the style of Microsoft technical screens, set in license compliance for Microsoft 365 tenants. Counting the peak is common; the interviewer here checks that you can emit the actual over-cap ranges and order simultaneous start and end events correctly.

What the Interviewer Expects
  • Convert intervals into +1 and -1 events
  • Sort events by time with ends before starts at the same time
  • Track the running count while sweeping
  • Open a range when count crosses above C and close it when it drops back
  • Merge adjacent ranges that touch
Key Topics to Cover
sweep line
events
intervals
sorting
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 report the maximum overage and when it happened?
  • What if sessions stream in and you need an alert the moment the cap is crossed?
  • How would you compute total over-cap minutes per tenant across a month?
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 sessions [start, end) (half-open, so a session ending at 5 and another starting at 5 do not overlap) and integer C >= 0. Output: sorted list of [from, to) ranges with concurrency ...

High-Level Design

Create events (start, +1) and (end, -1). Sort by time, and at equal times process -1 before +1, which encodes the half-open rule; sorting tuples with -1 < +1 does this for free. Sweep with a r...


Submit Your Answer
Markdown supported