Return the number of distinct users active in each trailing 7-day window, one row per day.
D - 6 through D0, not a missing rowday is formatted YYYY-MM-DDday ascendingactivity| user_id | active_at |
|---|---|
| 1 | 2024-01-01 10:00:00 |
| 2 | 2024-01-03 10:00:00 |
| day | active_users |
|---|---|
| 2024-01-01 | 1 |
| 2024-01-02 | 1 |
| 2024-01-03 | 2 |
activity| user_id | active_at |
|---|---|
| 5 | 2024-02-01 08:00:00 |
| 5 | 2024-02-01 20:00:00 |
| 5 | 2024-02-02 09:00:00 |
| day | active_users |
|---|---|
| 2024-02-01 | 1 |
| 2024-02-02 | 1 |
Community-reported interview topic. Not an official company question and no affiliation is implied.
Run against the public tests, or submit to score against all of them.