Premium problem100. Active Three Days Running

Hard Locked

events has columns user_id and event_date (datetime). A user can log many events on the same calendar day.

Return the users who were active on at least three consecutive calendar days, as a Series of user ids sorted ascending with the index renumbered from 0.

Several events on one day are still one day, so the duplicates have to go before the consecutive check, not after.

Input

   user_id event_date
0        1 2022-05-01
1        1 2022-05-01
2        1 2022-05-02
3        1 2022-05-03
4        2 2022-05-01
5        2 2022-05-03
6        3 2022-06-10
7        3 2022-06-11
8        3 2022-06-13

Output

0    1
dtype: int64

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)