HARDCommunity Reported• Data Scientist

Binge-Watching Session Identification

A candidate reported this streaming analytics problem from a top media company interview.

A "binge session" is defined as a series of 3 or more video watches by the same user where each subsequent watch began within 30 minutes of the previous watch ending.

Write a query to identify all user_ids who had at least one binge session on 2026-02-14. Output user_id in ascending order with no duplicates.

Table:

  • watch_events (event_id INT, user_id INT, start_time TIMESTAMP, end_time TIMESTAMP)

Execution Sandbox:

Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.

Standard SQL (ANSI)|Ln 1, Col 1
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.