HARDCommunity Reported• Data Scientist
Binge-Watching Session Identification
Verified Source:Community Reported Experience
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_idINT,user_idINT,start_timeTIMESTAMP,end_timeTIMESTAMP)
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(7 lines, 117 chars)
Tab Indent⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.