Weekly Retention of Users After Their First Deployment

Last updated: November 29, 2026

Quick Overview

Given users, deployments, and daily activity tables, compute for each weekly cohort of users (grouped by the week of their first deployment) the share of the cohort active in each of the following four weeks.

Replit
Data Manipulation (SQL/Python)
Data Scientist
Replit
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Given users, deployments, and daily activity tables, compute for each weekly cohort of users (grouped by the week of their first deployment) the share of the cohort active in each of the following four weeks.

Shipping a deployment is a key moment in the Replit funnel, since it is when a project becomes a live app, so analytics interviews naturally probe cohort retention around it. The interviewer checks clean cohort definition, correct week offsets, and that the denominator is the full cohort.

What the Interviewer Expects
  • Defines the cohort by first deployment per user, not every deployment
  • Computes week offsets from the cohort week consistently
  • Uses COUNT DISTINCT on users per week
  • Divides by cohort size, keeping weeks with zero activity
  • Mentions immature cohorts at the end of the window
Key Topics to Cover
cohort analysis
window offsets
COUNT DISTINCT
date truncation
retention
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 compare Agent built apps with hand-written ones?
  • How would you exclude activity that is only the deployment itself?
  • Why might Autoscale and Reserved VM users retain differently?
  • How would you present this as a retention curve with confidence bands?
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

deployments(deployment_id, user_id, created_at), activity(user_id, activity_date) with one row per user per active day. Active means any workspace session. Weeks start Monday (`date_trunc('week', ...

Approach
  1. First deployment week per user. 2) Cohort sizes. 3) Join activity, compute whole-week offset, keep offsets 1 to 4, count distinct users. 4) Left join onto a cohort by week grid so zero weeks show a...

Submit Your Answer
Markdown supported

Related Questions