Longest Uninterrupted Work Block
Reported by candidates from Intuit's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Intuit OA reported in September 2026 looks like a scheduling puzzle, but the hinted dynamic-programming label is a red herring. It's group, clip, sort, merge, then measure gaps. If you've seen merge intervals, you've seen this. The traps are in the details: half-open windows, meetings that fall fully outside business hours, and the string sorting of the output. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the logic below is short enough to carry in your head.
The problem
You are given meeting intervals for several employees on several workdays. Each row of meetings is [employeeId, day, startMinute, endMinute], where the interval is half-open: the employee is busy from startMinute through endMinute - 1. For every distinct (employeeId, day) pair appearing in the input, find the longest uninterrupted free block inside the half-open business window [businessStart, businessEnd). Clip meetings to business hours and merge overlapping or touching busy intervals before measuring free time. Return one string per pair in the form employeeId|day|minutes, sorted first by employeeId and then by day, both lexicographically. Function longestWorkBlocks(meetings: String[][], businessStart: int, businessEnd: int) → String[] Examples Example 1 meetings = [["e1","2026-09-18","540","600"],["e1","2026-09-18","630","690"],["e2","2026-09-18","600","720"]] businessStart = 540 businessEnd = 1020 return = ["e1|2026-09-18|330","e2|2026-09-18|300"] Employee e1 has free gaps of 30 and 330 minutes. Employee e2 has gaps of 60 and 300 minutes. Example 2 meetings = [["a","d1","400","550"],["a","d1","540","620"],["a","d1","900","1100"]] businessStart = 480 businessEnd = 1020 return = ["a|d1|280"] The first two meetings clip and merge into [480,620), while the last clips to [900,1020). The longest free gap is [620,900). Constraints 1 <= meetings.length <= 100000. Every row has exactly four strings and identifies a nonempty employee and day. Times are decimal integers satisfying 0 <= startMinute < endMinute <= 1440. 0 <= businessStart < businessEnd <= 1440. Every distinct employee-day pair has at least one row, but all of its rows may lie outside business hours.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Here's the reduction. Group rows by (employeeId, day) in a hash map. For each group, clip every meeting to [businessStart, businessEnd) by taking max of start and businessStart and min of end and businessEnd. Drop anything where the clipped start is not less than the clipped end. Sort by start, then sweep with a cursor beginning at businessStart. If the next meeting starts after the cursor, the gap is start minus cursor. Then move the cursor to max(cursor, end). After the sweep, check the gap from cursor to businessEnd. Merging happens implicitly through the cursor. The pitfall is a pair whose meetings all fall outside the window. It must still be output, with the full window length. Parse the times as integers, and sort output keys lexicographically as strings, not numerically. Total cost is O(n log n). If you freeze on the live OA, StealthCoder can hand you this skeleton so you only fix the edge cases.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Longest Uninterrupted Work Block cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Intuit's OA.
Intuit reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Longest Uninterrupted Work Block FAQ
How hard is the Intuit Longest Uninterrupted Work Block question really?+
It's medium at most. The core is merge intervals with a grouping step on top. Nothing needs real dynamic programming. Most of the difficulty is clean handling of clipping, empty groups, and output formatting, not the algorithm.
What's the trick to solving it fast?+
Skip an explicit merge step. Sort each group's clipped meetings by start and keep a cursor that begins at businessStart. Each time a meeting starts past the cursor, record the gap, then advance the cursor to the max of itself and the meeting's end. Finish with the tail gap.
What happens if every meeting for a pair is outside business hours?+
The pair still appears in the output. After clipping, its list is empty, so the whole window is free. The answer is businessEnd minus businessStart. Forgetting this is the most likely hidden-test failure, since the constraints state it explicitly.
How should I sort the output?+
Sort by employeeId, then by day, both as plain strings. Don't parse days as dates or numbers. Build each result as employeeId|day|minutes and sort on the pair of keys. Be careful that e10 comes before e2 lexicographically.
How do I prepare for this in 48 hours?+
Write merge intervals and a gap-finding sweep from scratch twice. Then practice grouping with a hash map keyed on a pair. Test edge cases: touching intervals, meetings spanning the whole window, and meetings fully outside it. That covers this problem.