Banking System, Part 1: Accounts and Transfers
Reported by candidates from Anthropic's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The data structure here is a plain hash map from account ID to balance, and that's the whole game. Anthropic reportedly used this banking system question in July 2026, and it's Part 1 of a four-part series, so the real test is how cleanly you set up the code for later levels. Three operations: create, deposit, transfer. Everything returns strings, and failures return "null". It's easy to solve and easy to botch on small details. If you blank under the clock, StealthCoder runs invisibly on your screen during the live OA and hands you the structure.
The problem
Banking System series Part 1: Accounts and Transfers Part 2: Top Spenders Part 3: Scheduled Payments Part 4: Merging and Balance History Implement the first level of a simplified banking system. The system starts with no accounts and processes operations in strictly increasing timestamp order. Operation Format Each row in operations contains an operation name followed by its arguments, all represented as strings. Return one row for every operation: A scalar result is returned as a one-element row, such as ["true"] or ["750"]. A source-level None result is returned as ["null"]. Level 1 Operations ["CREATE_ACCOUNT", timestamp, account_id]: Create an account with balance 0 if the ID does not exist. Return true on success and false if the account already exists. ["DEPOSIT", timestamp, account_id, amount]: Add amount to the account. Return its new balance, or null if the account does not exist. ["TRANSFER", timestamp, source_account_id, target_account_id, amount]: Transfer money between two different accounts. Return the source account's new balance on success. Return null if either account does not exist, both IDs are equal, or the source has insufficient funds. Function bankingSystemLevel1(operations: String[][]) → String[][] Examples Example 1 operations = [["CREATE_ACCOUNT","1","alice"],["CREATE_ACCOUNT","2","bob"],["DEPOSIT","3","alice","1000"],["TRANSFER","4","alice","bob","250"],["DEPOSIT","5","bob","50"]] return = [["true"],["true"],["1000"],["750"],["300"]] Alice receives 1000, sends 250 to Bob, and keeps 750. Bob then has 250 from the transfer plus the 50 deposit. Example 2 operations = [["CREATE_ACCOUNT","1","alice"],["CREATE_ACCOUNT","2","alice"],["DEPOSIT","3","missing","100"],["TRANSFER","4","alice","alice","10"],["CREATE_ACCOUNT","5","bob"],["TRANSFER","6","alice","bob","10"],["DEPOSIT","7","alice","100"],["TRANSFER","8","alice","bob","40"]] return = [["true"],["false"],["null"],["null"],["true"],["null"],["100"],["60"]] The duplicate creation, missing-account deposit, same-account transfer, and insufficient-funds transfer fail. After Alice receives 100, the final transfer succeeds and leaves her with 60. Constraints 1 <= timestamp <= 10^9 All timestamps are unique and operations are provided in strictly increasing timestamp order. Amounts are positive integers and all numeric results fit in a signed 64-bit integer. Every operation has exactly the arguments shown above.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Keep one dictionary: account_id to integer balance. CREATE_ACCOUNT checks membership, inserts 0, returns true or false. DEPOSIT looks up the account, adds, returns the new balance as a string, or null if missing. TRANSFER is where people slip. Check both accounts exist, check the IDs differ, check the source balance is at least the amount, then move the money and return the source's new balance. Every result goes in a one-element list of strings, including "null". Pitfalls: returning Python None instead of the string "null", forgetting the same-account check, and using a strict greater-than on funds. Since this is Part 1 of a series, write each operation as its own small method so later parts can plug in. StealthCoder is your hedge if the formatting rules or the transfer ordering slip your mind mid-assessment.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Banking System, Part 1: Accounts and Transfers cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Anthropic's OA.
Anthropic reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Banking System, Part 1: Accounts and Transfers FAQ
How hard is the Anthropic Banking System Part 1 really?+
Easy on algorithms, strict on details. It's a hash map with three operations and no tricky complexity. Most lost points come from output formatting, like returning "null" as a string, or missing an edge case in TRANSFER. Slow down on the spec and you'll pass.
What's the trick to the TRANSFER operation?+
Validate everything before you mutate anything. Both accounts must exist, the two IDs must differ, and the source balance must cover the amount. Only then subtract and add. Return the source's new balance as a string. Any failed check returns ["null"].
Should I design for Parts 2 to 4 now?+
Lightly. The problem is a series, so later levels likely build on this state. Keep operations in separate methods and store accounts in a class or dictionary you can extend. Don't over-engineer, since you only need Level 1 to be correct.
Why does the output use strings for everything?+
The function returns String[][], so every result is a row of strings. Booleans become "true" and "false", balances become their decimal text, and a missing result becomes "null". Convert the amount arguments from strings to integers before doing math.
How do I prepare for this in 48 hours?+
Write a small bank class with a dict and the three operations, then run both examples from the prompt by hand. Add tests for duplicate creation, missing accounts, same-account transfers, and insufficient funds. Then practice a few similar in-memory design problems with simple state.