Compute max events in any 60-second window
Marshall WaceSoftware Engineer · OnsiteLast updated
This question evaluates understanding of timestamp and array processing, sliding-window or two-pointer techniques, and the ability to analyze time and space complexity when counting events within fixed-size intervals.
Design a function that, given a non-decreasing list of integer timestamps (seconds), returns the maximum number of events occurring within any contiguous 60-second window (inclusive). Aim for an O(n) time, O(
- extra-space solution.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.