Streaks and freezes

MediumDuolingogaps and islandsunionstreaks with freeze dayscurrent streakcoming back after a break· 60 XP (20 per question)

Mock interview. You're interviewing for a data scientist job at a language learning app. A streak is the number of days in a row a learner has practised. If they miss a day, a streak freeze can cover it so the streak survives. The interviewer says: "Streaks are central to our habit loop. Help me understand them, using August and September 2026."

  • lesson_days: one row per learner per day they practised.
  • streak_freezes: one row per learner per day a freeze covered a missed day.

A streak is a run of consecutive days that are either a lesson day or a freeze day.

Question 1: Current streaks

"On 30 September, what is each learner's current streak? A learner whose streak doesn't include 30 September has a current streak of 0. Show how many learners are in each band: 0, 1-6, 7-29, 30+."

Expected output

  • Columns streak_band, learners; every learner in lesson_days counted once; sorted from 0 up

Example of the shape (made-up values):

streak_band learners
0 50

Hints, the later questions and the answer come with Pro.

Question 1 of 3

Write your query here. Ctrl + Enter submits.