Algorithm · Discord · Hard
Given a list event_lines, each element is a newline-delimited JSON string from a chronologically ordered prefix of a potentially unbounded event stream. Every event has this shape: The value of event_name is always "send_message", and timestamps are UTC ISO-8601 strings. Define a session for one user_id as a maximal run of consecutive events where the time between two adjacent events is at most 30 minutes, inclusive. If the next event for that user arrives more than 30…
Checking your access…