← Questions

Time on page from the next user event

0
AirbnbCodingLast asked Sep 2026

Given a table of user events with timestamps, estimate how long each user stayed on each page as the time until that user's next event. Use LEAD() partitioned by user and ordered by time, then take the difference. Decide what to do with each user's last event and with very long gaps.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding