Peak Concurrent License Seats From Checkout Logs

Last updated: November 29, 2026

Quick Overview

Given a list of license checkout intervals [start, end) from a network license server, return the maximum number of seats in use at once and the merged time windows during which that peak is held.

MathWorks
Coding & Algorithms
Software Engineer
MathWorks
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Given a list of license checkout intervals [start, end) from a network license server, return the maximum number of seats in use at once and the merged time windows during which that peak is held.

MathWorks sells concurrent network licenses for MATLAB and its toolboxes, and admins size seat counts from license manager logs. This onsite coding question checks a sweep line over sorted events, careful handling of equal timestamps under half-open intervals, and reporting more than a single number.

What the Interviewer Expects
  • Converts intervals into +1 and -1 events and sorts them
  • Orders a release before a checkout at the same timestamp because intervals are half-open
  • Tracks the running count and the peak, resetting the window list when a new peak appears
  • Merges adjacent peak windows so the output is not fragmented
  • Discusses invalid or zero-length intervals
Key Topics to Cover
sweep line
interval events
sorting with tie-breaks
half-open intervals
license usage analytics
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 answer 'peak seats per toolbox' when each log line also has a feature name?
  • How would you compute the total time spent at or above a given seat count, say 90 percent of capacity?
  • If logs arrive out of order in real time, how would you maintain the current peak online?
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) pairs with start < end, meaning a seat is held for times t with start <= t < end. Output: (peak, windows) where windows is a sorted list of maximal [s, e) ran...

High-Level Design

Emit (start, +1) and (end, -1) for each checkout and sort. Python sorts tuples so that at the same time -1 comes before +1, which is exactly the half-open rule: a seat returned at 5 can be reu...


Submit Your Answer
Markdown supported

Related Questions