hardapp activity · Q2
gaps and islandswindow functions

Longest activity streak

For every user who has at least one event, find their longest streak: the most consecutive calendar days in a row on which they had at least one event.

A user active on Mar 1, 2, 3, 5 and 6 has streaks of 3 and 2, so their longest streak is 3. Several events on the same day still count as one day.

output columns
user_idlongest_streak

uses

ctrl + enter to run on the sample data · ctrl + shift + enter to submit

run your query to see the output here. Submit checks it against the sample data, hidden test cases, random data and a large dataset.