Three-Day Login Streaks
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Table logins:
user_id INTEGER
day TEXT 'YYYY-MM-DD'
(a user can have several rows for the same day)
Return every user who has logged in on at least three consecutive calendar days, with the length of their longest run of consecutive days.
Columns, in this order: user_id, longest streak in days.
Order by longest streak descending, then user_id ascending.
Examples
Constraints
- Several logins on one day count as one day.
- Users whose longest run is under three days are left out.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.