Find Reels Creators with Posting Streaks of Three Days
Last updated: November 29, 2026
Quick Overview
Given a table of Reels uploads, write SQL that returns every creator whose longest streak of consecutive posting days is at least three, along with that longest streak.
Meta
November 29, 20260
0
0 solved
Given a table of Reels uploads, write SQL that returns every creator whose longest streak of consecutive posting days is at least three, along with that longest streak.
Creator consistency matters to Reels growth, and streak questions are a common gaps-and-islands pattern in Meta SQL screens. The interviewer checks deduplicating to one row per day, the row-number subtraction trick, and handling multiple posts on the same day.
What the Interviewer Expects
- Reduces to distinct creator-day pairs before windowing
- Uses the date minus row number trick to label islands
- Aggregates island lengths and takes the max per creator
- Explains why duplicates on one day would break the logic
- States the timezone assumption
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you return the start and end date of each creator's longest streak?
- What if a streak may tolerate one missed day?
- How would you compute the current active streak as of today?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Table: reels(reel_id, creator_id, created_at). A creator may post several Reels on one day. Days are in UTC (in production I would ask whether to use the creator's local date, since streaks feel loc...
Approach
For each creator, take distinct posting dates and number them in order. Within a run of consecutive dates, the date and the row number both increase by one each step, so date - row_number is constan...