Checkout Funnel
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Table events:
user_id INTEGER
step TEXT 'view', 'cart' or 'purchase'
at TEXT 'YYYY-MM-DD HH:MM'
A user can fire the same step many times, and nothing forces the steps to arrive in order.
Return one row with how many distinct users reached each stage, where reaching a stage means having fired that step and every step before it:
viewed — fired 'view'
carted — fired 'view' and 'cart'
purchased — fired 'view', 'cart' and 'purchase'
Columns, in this order: viewed, carted, purchased.
The result is always exactly one row.
Examples
Constraints
- Timestamps do not matter for this question, only which steps a user has.
- An empty table gives 0 | 0 | 0.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.