Your question is Detect Anomalous User Event Bursts. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a list of user activity events events, where each event is a pair [user_id, timestamp], and two integers window_size and max_events, write a function that returns all user_id values that are anomalous. A user is anomalous if they perform more than max_events events within any inclusive time window of length window_size. Return the flagged user IDs in sorted order.
def detect_anomalies(events, window_size, max_events):