Flag Creators With Three Straight Weeks of Shrinking Follower Growth
Last updated: November 29, 2026
Quick Overview
Given weekly net new followers per creator, return creators whose net new followers declined week over week for three consecutive weeks, along with the first week the condition was met, treating missing weeks as breaking the streak.
TikTok
November 29, 20260
0
0 solved
Given weekly net new followers per creator, return creators whose net new followers declined week over week for three consecutive weeks, along with the first week the condition was met, treating missing weeks as breaking the streak.
TikTok's creator success teams proactively reach out to mid-tier creators whose growth stalls, so they need a reliable early-warning list. The interviewer checks LAG usage, how missing weeks are handled, and whether you can express 'three in a row' without self-joining three times.
What the Interviewer Expects
- Use LAG to compare each week with the previous one
- Require the previous row to be exactly one week earlier
- Count consecutive declines with a rolling window sum
- Return the first week the condition triggers
- Discuss noise and minimum-volume filters
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 require the decline to be at least 10% each week?
- How would you make the rule robust for creators with very small follower counts?
- How would you return every separate decline episode instead of just the first?
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
follower_weekly(creator_id, week_start, net_new_followers), one row per creator per week with activity. Weeks with no row are missing (the creator may have been inactive or the job failed).- **De...
Approach
LAGgives the previous value and previous week.declined = 1only if the previous week is exactly 7 days earlier and the value dropped.- A 3-row rolling
SUM(declined)equal to 3 means th...