The Game Play Analysis IV interview question is the most complex of the series. You need to report the fraction of players who logged in again exactly on the day after the day they first logged in, rounded to 2 decimal places. In marketing terms, you are calculating the "Day 1 Retention Rate."
Companies like Meta and Google use this Database interview pattern to test advanced metric calculation. It requires combining finding the "first event" (like in part I), performing date arithmetic (adding 1 day), and then checking for existence using a JOIN or IN clause. It evaluates your ability to build a multi-step query to derive a high-level business KPI.
This problem requires a Subquery and Date Arithmetic.
player_id and MIN(event_date) (their first login).Activity table. Look for a row where the player_id matches AND the Activity.event_date is exactly one day after the first_login date. Use functions like DATE_ADD() or DATEDIFF().Players and their first logins:
Total players = 3. Retained players = 1. Fraction = .
date + 1) that might fail in other environments. Standardizing on DATE_ADD(date, INTERVAL 1 DAY) or similar explicit functions is safer."Retention" is a massive keyword in data engineering. If you see it, you will almost certainly need to find a user's initial cohort date (their first action) and then join that back to the event log to see if they performed an action days later.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Confirmation Rate | Medium | Solve | |
| Product Sales Analysis III | Medium | Solve | |
| Rank Scores | Medium | Solve | |
| Product Price at a Given Date | Medium | Solve | |
| Friend Requests II: Who Has the Most Friends | Medium | Solve |