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
Data Manipulation (SQL/Python)
Data Scientist
TikTok
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

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
LAG
window frames
week over week
consecutive events
alerting
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. 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 Problems
Sample 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
  1. LAG gives the previous value and previous week.
  2. declined = 1 only if the previous week is exactly 7 days earlier and the value dropped.
  3. A 3-row rolling SUM(declined) equal to 3 means th...

Submit Your Answer
Markdown supported