Analyze Posting Behavior by Cohort and Date
Company: TikTok
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Technical Screen
Overview: This question evaluates a candidate's ability to perform cohort-based user attribution and time-series aggregation, specifically assigning users to acquisition cohorts by their first activity and computing total posts and distinct active users by date.
Tables
creator_post(post_date DATE, user_id INTEGER, post INTEGER)
Hints
- Compute each user’s cohort as MIN(post_date) using a window function or a grouped subquery/CTE.
- Join the cohort mapping back to creator_post, then aggregate by cohort_start_date and post_date with SUM(post) and COUNT(DISTINCT user_id).