Reported April 2026
Scale AIarray

Free Time for Every Meeting Room

Reported by candidates from Scale AI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Scale AI OA. Under 2s to a working solution.
Founder's read

Scale AI reported this one in April 2026, and the constraints are the first thing to read. Up to 100000 bookings, 10000 rooms, and times up to a billion. That kills any per-time-unit scan and any room-by-room rescan of every booking. It's a per-room interval merge, an array and sorting problem in disguise. You need free gaps for each room inside a window, with overlaps, duplicates and touching intervals all handled. If you blank on the grouping step during the assessment, StealthCoder runs invisibly as a safety net while you work.

The problem

You are given the busy schedule of roomCount meeting rooms. Room identifiers are the integers 0 through roomCount - 1. Each row of bookings is [room, start, end] and makes that room busy during the half-open interval [start, end).
Find every maximal positive-length interval when each room is free within the half-open planning window [windowStart, windowEnd).
Bookings may overlap, repeat, or appear in any order. A room is busy whenever at least one of its bookings covers the time.
Touching busy intervals form one continuous busy block.
Include free time before a room's first booking and after its last booking when it lies in the planning window.
A room with no bookings is free throughout the entire window. A room busy throughout the window contributes no row.
Return an int[][] whose rows are [room, freeStart, freeEnd], ordered by room identifier and then by interval start. Every booking lies entirely within the planning window.

Function
freeRoomIntervals(roomCount: int, bookings: int[][], windowStart: int, windowEnd: int) → int[][]

Examples
Example 1
roomCount = 2
bookings = [[0,2,4],[0,3,6],[1,0,2],[1,5,10]]
windowStart = 0
windowEnd = 10
return = [[0,0,2],[0,6,10],[1,2,5]]
Room 0 has a merged busy block [2,6). Room 1 is busy in [0,2) and [5,10). The returned rows are exactly the remaining portions of the window.
Example 2
roomCount = 3
bookings = [[0,0,5],[0,5,10],[1,2,7],[1,3,4]]
windowStart = 0
windowEnd = 10
return = [[1,0,2],[1,7,10],[2,0,10]]
Room 0 has no free time because touching bookings cover the window. Room 1 has one nested booking that changes no busy coverage. Room 2 is free for the whole window.
Example 3
roomCount = 1
bookings = []
windowStart = 5
windowEnd = 8
return = [[0,5,8]]
With no bookings, the room is free throughout the planning window.
Example 4
roomCount = 1
bookings = [[0,1,9]]
windowStart = 1
windowEnd = 9
return = []
The single booking covers the entire planning window, so there are no free intervals.

Constraints
1 <= roomCount <= 10000.
0 <= bookings.length <= 100000.
Each booking has exactly three integers and satisfies 0 <= room < roomCount.
0 <= windowStart < windowEnd <= 1000000000.
Each booking satisfies windowStart <= start < end <= windowEnd.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to sort once, then sweep. Sort bookings by room, then start, then end. Walk through them while tracking the current room and a cursor, which is the end of busy coverage so far, starting at windowStart. For each booking, if start is greater than the cursor, emit [room, cursor, start]. Then set cursor to max(cursor, end). When the room ends, emit [room, cursor, windowEnd] if the cursor is below windowEnd. Rooms with no bookings emit the full window, so loop through all room IDs, not just the ones you saw. Pitfalls: using min instead of max for the cursor on nested bookings, treating touching intervals (start equals cursor) as a gap, and forgetting empty rooms. Complexity is O(n log n + roomCount). If the sweep logic slips under pressure, StealthCoder is the hedge on the live OA.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Free Time for Every Meeting Room 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 by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Scale AI's OA.

Scale AI reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Free Time for Every Meeting Room FAQ

What's the core trick in Free Time for Every Meeting Room?+

Sort bookings by room and start, then sweep with a cursor holding the furthest busy end so far. A gap exists only when the next start is strictly greater than the cursor. Update the cursor with max, not assignment, so nested bookings don't shrink coverage.

Why can't I brute force this with a time array?+

Times go up to 1,000,000,000 and there can be 10000 rooms. Marking each time unit per room is far too much memory and time. Bookings max out at 100000, so work should depend on bookings and rooms, not on the window length.

How do I handle touching or duplicate bookings?+

Touching means start equals the cursor, which is not a gap, so emit nothing. Duplicates and nested bookings never raise the cursor past its current max, so they change nothing. The strict greater-than check plus max update covers all three cases.

What edge cases trip people up?+

Rooms with zero bookings must output the full window, so iterate all IDs from 0 to roomCount - 1. Also emit the trailing gap after the last booking if the cursor is below windowEnd. And a fully covered room, like example 4, must contribute no rows.

How do I prep for this in 48 hours?+

Write the interval merge sweep from memory a few times, then adapt it to group by room. Make sure output order is room first, then start. Test against the four examples, especially the empty bookings case and the fully covered window case.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Scale AI.

OA at Scale AI?
Invisible during screen share
Get it