~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
Bank system
Accounts, transfers that must be accepted, merges; state machines.
Notes
Format: CodeSignal-style, 4 levels.
Strategy
- An
Accountobject withbalance,outgoingandhistory. - Delayed effects (cashback): a heap of
(due_time, seq, payment), drained at the top of every method. - Balance history: append
(time, balance)on every change, andbisectit for "balance at time t". - Merges: move pointers (a payment's owner) instead of copying data around.
Gotchas: are failed operations counted? Is rounding down done with integer division? Is an effect due at time T applied before an operation at T?
3 problems
Practical systems
Stateful stores Key-value stores, file systems, banks, with history.
Bank system
- Basics: accounts with validated deposits and withdrawals basics py · c++ · java easy
- Settle a night's tab all-or-nothing easy
- OA: Bank system 4 levels Anthropic py · c++ · java medium