Party Windows and Dead Zone Time
Problem statement
You receive party submissions and geographic records.
- Each row of
submissionsis[start_time, end_time, party_id]. - Each row of
geographicDatais[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_idappears 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 satisfystart_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.
Source note: Original Party Time technical-screen prompt, displayed with FastPrep branding added outside the preserved source pixels.