You run a mobile app called Party Time where people post about parties happening in their area. Users record when they hear about a party starting and ending. This information, along with location metadata, is submitted to the app.
As part of an effort to understand which neighborhoods are the most active in partying, we want to determine the party window for each neighborhood.
A party window is a time range (inclusive) from the earliest party start to the latest party end in that neighborhood.
Example: If a neighborhood has two parties on a given day:
Given JSON party data, implement compute_party_windows() to determine the party window for each neighborhood.
Once we have party windows, we want to share data about party dead zones - time ranges for a given town when NO neighborhoods within that town have an active party window.
Example: Imagine a town with two neighborhoods:
neighborhood_a has a party window from 8AM to 2PMneighborhood_b has a party window from 6PM to 11PMImplement compute_dead_times() that maps towns to their total dead zone time in hours.
Each party record contains:
party_id: Unique identifierneighborhood: Name of the neighborhoodtown: Name of the towncity: Name of the citystate: State abbreviationstart_time: ISO datetime string (e.g., "2024-01-15T10:00:00")end_time: ISO datetime string (e.g., "2024-01-15T14:00:00")