Lyra Health wants to identify the busiest short periods in an activity timeline. Given usage log timestamps, an analysis window, and an interval length, return every candidate interval containing the maximum number of logs.
Candidate intervals must start at the analysis window's start or at a timestamp present in the input. Intervals use half-open boundaries [start, end), so a log at end is excluded. Return intervals as [start, end] pairs, sorted by start time. If no timestamps fall inside the analysis window, return [].
Implement peak_usage_intervals(timestamps, window_start, window_end, interval_length).
timestamps is a list of integer timestamps.window_start and window_end define the analysis range [window_start, window_end).interval_length is a positive integer.def peak_usage_intervals(timestamps, window_start, window_end, interval_length):