Running Balance
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 transactions:
id INTEGER primary key; ids increase in the order transactions happened
account_id INTEGER
amount INTEGER positive for a deposit, negative for a withdrawal
Return every transaction with the account's balance after it. Each account starts at 0.
Columns, in this order: account_id, transaction id, amount, balance after this transaction.
Order by account_id, then transaction id.
Examples
Constraints
- Balances can go negative.
- Accounts are independent of each other.
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.