Skip to interview prep
Apexed

5. Day-1 retention

MediumPandas & NumPy

Rows are events with user and day (0 = signup day). Day-1 retention is the share of users with an event on day 0 who also have an event on day 1. Return it rounded to 2 decimals (0.0 if nobody signed up).

Input rows arrive as a list of dictionaries; build a DataFrame with pd.DataFrame(rows).

Example 1

Input: users a, b on day 0; a returns on day 1
Output: 0.5

Constraints

  • A user may have several events per day

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 3 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Day-1 retention — coding interview practice — Apexed