Interview Query

Longest Streak Users

Start Timer

0:00:00

Upvote
56
Downvote
Save question
Mark as completed
View comments (59)
Next question

Given a table with event logs, find the top five users with the longest continuous streak of visiting the platform.

Note: A continuous streak counts if the user visits the platform at least once per day on consecutive days.

Example:

Input:

events table

Column Type
user_id INTEGER
created_at DATETIME
url VARCHAR

Output:

Column Type
user_id INTEGER
streak_length INTEGER
.
.
.
.
.


Comments

Loading comments..