Between the Clicks
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid
Problem
Our ad-click pipeline ingests events under at-least-once delivery, so a single user's clicks can arrive out of order. Each event has a `user` and a `ts` in seconds; reconstruct each user's sessions, where a session is a stretch of that user's activity with no more than `gap` seconds between one click and the next. For each session, report the user, its first and last timestamp, and how many clicks fell inside it.
Summary
Clicks arrive scrambled. Find where one visit ends and the next begins.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.