FunctionRacerProblemsRace

Longest Login Streak

HardpandasPython

logins has columns user and day (a date such as "2026-01-31"). A user can log in several times on one day. Return a dict from each user to the length of their longest run of days in a row.

Example 1

logins {"user":["ann","ann","ann","bob","ann","bob","ann"],"day":["2026-01-30","2026-01-31","2026-02-01","2026-02-01","2026-02-03","2026-02-03","2026-01-31"]}
returns {"ann":3,"bob":1}

ann logged in on Jan 30, Jan 31 and Feb 1: three days in a row, across the end of the month. bob's two days are not next to each other.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems