Group Events by Session

Problem Given a single user's timestamped events (sorted by time), split them into sessions and count the events in each. A new session begins whenever the gap between two consecutive events exceeds 30 minutes of inactivity.

Input / Output

  • Input: a time-sorted list of event timestamps for one user.
  • Output: a list of sessions, each with its event count (and optionally its start/end time).

Constraints

  • Events are sorted by ascending timestamp.
  • The inactivity threshold is 30 minutes; make the boundary rule (> vs >=) explicit.

Example

  • Events at 0, 10, 25, 70, 80 min (threshold 30) -> session A = {0,10,25} (3 events), session B = {70,80} (2 events); the 45-min gap between 25 and 70 splits them.
added …
LeaderboardSalaryAccount