Find Where Each Signup Cohort's Retention Curve Flattens

Last updated: November 29, 2026

Quick Overview

Given daily retention curves for several signup cohorts as Python lists, write a function that returns, for each cohort, the first day after which the curve never drops more than a threshold over any later window, along with the plateau level.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given daily retention curves for several signup cohorts as Python lists, write a function that returns, for each cohort, the first day after which the curve never drops more than a threshold over any later window, along with the plateau level.

At Meta, the question "does this app's retention curve flatten, and where?" is a standard health check for new products like Threads or Meta AI. In a Python screen it tests whether you can turn a fuzzy product notion into a precise, testable rule and implement it in linear time.

What the Interviewer Expects
  • Translate flattening into a precise rule with window and threshold
  • Require the condition to hold for the whole tail, not just once
  • Implement in a single backward pass
  • Handle curves too short to evaluate
  • Return the plateau level as well as the day
Key Topics to Cover
retention curve
plateau detection
backward scan
noise handling
product health
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 choose the window and threshold for a weekly-use product?
  • How would you make this robust to weekday noise?
  • How could you fit a parametric curve instead and read the asymptote?
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

Each curve is a list where curve[d] is the fraction of the cohort active on day d, already computed. Curves may differ in length because younger cohorts have fewer days. Defaults: window 7 days, thr...

Approach

Define drop[d] = curve[d] - curve[d + window]. The flattening day is the smallest d such that drop[k] < threshold for every k from d to the end. A backward scan finds it in one pass: walk from the...


Submit Your Answer
Markdown supported