Candidate telemetry diagnostic, error autopsy, and step-by-step query construction walkthrough.
Live aggregated metrics across candidate sandbox attempts
35 solved
First attempt fail
Evaluated submissions
Median time to solve
Unlocked answer
Before launching a test, a PM asks: "how long will this take to run?" You're evaluating a pricing-page experiment:
Using the standard pocket formula n_per_arm = 16 * p * (1 - p) / mde**2, compute the required sample size per arm, the total sample size (both arms), and the estimated number of days to run the test.
Return a dict result with keys n_per_arm (int), total_n (int), and days_required (rounded to 1 decimal).
Operating on a DataFrame slice without `.copy()`, producing `SettingWithCopyWarning`, or using `.apply(axis=1)` with custom Python functions when vectorized NumPy / pandas column operations could run 50x faster with 0 memory overhead.
Interviewers assess whether you write idiomatic, vectorized pandas code instead of slow row-by-row procedural Python loops.
Construct the solution logically from first principles to avoid typical edge case pitfalls.
Use boolean masks with `.loc[row_mask, col_list]` to avoid chained assignment warnings.
subset = df.loc[df['status'] == 'completed'].copy()
Use numpy/pandas native operations like `.groupby()`, `.transform()`, or column arithmetic.
df['rev_share'] = df['revenue'] / df.groupby('country')['revenue'].transform('sum')Sort values and reset index to match the required evaluation output contract.
result = df.sort_values('rev_share', ascending=False).reset_index(drop=True)baseline_cvr = 0.05
mde_abs = 0.01
daily_traffic = 3000
p = baseline_cvr
n_per_arm = 16 * p * (1 - p) / (mde_abs ** 2)
total_n = n_per_arm * 2
days_required = total_n / daily_traffic
result = {
"n_per_arm": int(round(n_per_arm)),
"total_n": int(round(total_n)),
"days_required": round(days_required, 1),
}
Real code patterns candidates submit that fail the grading suite.
results = []
for i, row in df.iterrows():
results.append(row['val'] * 2)Three recurring syntax and semantic traps relevant to this problem domain.
Modifying a filtered slice like df[df.age > 30]['salary'] = 5000 modifies an ephemeral copy instead of the underlying dataframe.
df[df['active'] == True]['status'] = 'verified' # ❌ SettingWithCopyWarning
df.loc[df['active'] == True, 'status'] = 'verified' # ✅ Idiomatic inplace assignment
Calling df.groupby('category').agg(...) places 'category' into the MultiIndex/Index, making subsequent column references fail.
res = df.groupby('dept')['salary'].mean(); print(res['dept']) # ❌ KeyErrorres = df.groupby('dept', as_index=False)['salary'].mean() # ✅ Keeps column intactIterating rows with for index, row in df.iterrows() is an anti-pattern in data science interviews.
for i, r in df.iterrows(): df.at[i, 'total'] = r['price'] * r['qty'] # ❌ Slow
df['total'] = df['price'] * df['qty'] # ✅ C-speed vectorization
Launch our in-browser coding environment. Run queries, view execution plans, and get instant comparative diff grading with no setup.