Party Windows and Dead Zone Time
Reported by candidates from Scale AI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Scale AI reported this one in October 2025, and the trap is sitting in the problem statement. Party Windows and Dead Zone Time looks like a messy join, but it's a hash join plus an interval merge. The edge case that breaks a naive solution: a neighborhood's window spans from its earliest start to its latest end, even if nobody is partying in the middle. Treat gaps inside a neighborhood as dead time and you fail Example 2. If you blank on the merge step during the live OA, StealthCoder runs invisibly as a safety net. Know the trick first, though.
The problem
You receive party submissions and geographic records. Each row of submissions is [start_time, end_time, party_id]. Each row of geographicData is [neighborhood, town, state, city, party_id]. Join the two datasets by party_id, then perform two computations. For each neighborhood, produce exactly one party window from the earliest party start in that neighborhood to the latest party end in that neighborhood. Time inside this window does not need to be continuously covered by active parties. Using those neighborhood windows, calculate each town's total dead-zone time. A dead zone is an interval strictly between the town's earliest neighborhood-window start and latest neighborhood-window end during which no neighborhood window in that town overlaps. Return a String[][]. First include one row ["WINDOW", neighborhood, start_time, end_time] for every neighborhood, ordered by neighborhood. Then include one row ["DEAD_ZONE_MINUTES", town, minutes] for every town, ordered by town. A town with no internal gap has 0 dead-zone minutes. Function analyzePartySchedule(submissions: String[][], geographicData: String[][]) → String[][] Examples Example 1 submissions = [["2025-01-01T09:00:00Z","2025-01-01T11:00:00Z","p1"],["2025-01-01T10:00:00Z","2025-01-01T12:00:00Z","p2"],["2025-01-01T14:00:00Z","2025-01-01T15:00:00Z","p3"]] geographicData = [["Pearl District","Greenville","NC","Normic","p1"],["Pearl District","Greenville","NC","Normic","p2"],["Riverfront","Greenville","NC","Normic","p3"]] return = [["WINDOW","Pearl District","2025-01-01T09:00:00Z","2025-01-01T12:00:00Z"],["WINDOW","Riverfront","2025-01-01T14:00:00Z","2025-01-01T15:00:00Z"],["DEAD_ZONE_MINUTES","Greenville","120"]] Pearl District has one window from its earliest start at 09:00 to its latest end at 12:00. Riverfront has a window from 14:00 to 15:00. No neighborhood window covers the interval from 12:00 to 14:00, so Greenville has 120 dead-zone minutes. Example 2 submissions = [["2025-06-10T08:00:00Z","2025-06-10T09:00:00Z","q1"],["2025-06-10T09:00:00Z","2025-06-10T10:00:00Z","q2"],["2025-06-10T11:00:00Z","2025-06-10T12:00:00Z","q3"],["2025-06-10T13:00:00Z","2025-06-10T14:00:00Z","q4"]] geographicData = [["Midtown","Springfield","IL","Springfield","q1"],["Midtown","Springfield","IL","Springfield","q2"],["Midtown","Springfield","IL","Springfield","q3"],["Harbor","Bayside","CA","Bayside","q4"]] return = [["WINDOW","Harbor","2025-06-10T13:00:00Z","2025-06-10T14:00:00Z"],["WINDOW","Midtown","2025-06-10T08:00:00Z","2025-06-10T12:00:00Z"],["DEAD_ZONE_MINUTES","Bayside","0"],["DEAD_ZONE_MINUTES","Springfield","0"]] Midtown has one window from its earliest start at 08:00 to its latest end at 12:00, even though no party is active from 10:00 to 11:00. Because Springfield has only this neighborhood window, that internal inactive hour is not a town dead zone. Bayside also has one neighborhood window and no internal gap. Constraints 1 <= submissions.length = geographicData.length <= 100000. Every row has the documented number of fields, and every party_id appears exactly once in each input. All timestamps are on the hour, use the fixed UTC form YYYY-MM-DDTHH:00:00Z, occur on the same calendar date, and satisfy start_time < end_time. Each neighborhood has exactly one party window: its minimum submitted start through its maximum submitted end, even when no party is active during part of that span. For the FastPrep runner, elapsed dead-zone duration uses half-open time arithmetic, so touching neighborhood windows leave no positive-duration gap. Every occurrence of one neighborhood maps to the same town.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Step one: map party_id to neighborhood and town with a hash map, then walk submissions and keep min start and max end per neighborhood. Timestamps are fixed-format UTC on the same date, so you can parse the hour or compare strings directly. Step two: group neighborhood windows by town, sort by start, and sweep. Track the running max end. If the next start is greater than the running max end, add the difference in minutes (hours times 60) to that town's dead-zone total. Touching windows give zero, so use strict greater-than. The pitfall is computing gaps from individual parties instead of neighborhood windows. Another is forgetting that towns with one window still need a row with 0. Sort the output by neighborhood, then town. Total cost is O(n log n). StealthCoder is the hedge if the sweep logic slips under the clock.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Party Windows and Dead Zone Time 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Scale AI's OA.
Scale AI reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Party Windows and Dead Zone Time FAQ
What's the trick in Party Windows and Dead Zone Time?+
Collapse each neighborhood to one window: min start to max end. Ignore gaps between its parties. Then merge windows per town and sum only the gaps between neighborhood windows. Most failures come from skipping the first collapse and counting inactive stretches inside a neighborhood.
How hard is this Scale AI OA question really?+
Medium at most. There's no fancy algorithm. It's a hash join, group-by min/max, and an interval sweep. The difficulty is reading the spec carefully and formatting the String[][] output in the right order with minutes as strings.
How do I compute dead-zone minutes correctly?+
Sort a town's neighborhood windows by start. Keep a running max end. When the next start is strictly greater than that max, add (start minus max end) in minutes. Touching windows add nothing. Update the max end after each window.
What edge cases should I test before submitting?+
Test a neighborhood with an internal inactive gap, like Example 2. Test a town with a single neighborhood, which returns 0. Test touching windows, which give 0. Test nested windows where one neighborhood sits fully inside another. Also check the output ordering.
How do I prepare for this in 48 hours?+
Practice interval merging and group-by aggregation with hash maps. Write the join, min/max, and sweep once from scratch. Then check your output ordering and string formatting. Sorting neighborhoods and towns alphabetically is easy to forget under pressure.