Code Room
Vibe codingHardvc-g264
Subject Ai code reviewLevel Senior–Staff~19 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

An AI built this split for a recommendation model where the same user appears in many rows. Offline metrics look great; online they don't. Explain the contamination.

python
from sklearn.model_selection import train_test_split # df: one row per (user_id, item_id, interaction)X = df.drop(columns=['clicked'])y = df['clicked']X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.2, random_state=0)model.fit(X_tr, y_tr)print('Test AUC:', roc_auc_score(y_te, model.predict_proba(X_te)[:,1]))
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.