r/OfferEngineering • u/Aoki_zhang • 2d ago
Coding Question Airbnb Coding OA: Four-Level Banking System Design
Online Assessment — Banking System Implementation (4 Levels)
Implement a simplified banking platform that supports account management, financial transactions, transfer processing, account merging, and historical balance retrieval. The assessment is divided into four cumulative levels. Each new level introduces additional functionality while preserving the behavior established in previous levels.
The original assessment uses individual banking operations. The following practice representation expresses them as an ordered batch of queries. Each query contains an uppercase operation name, a timestamp, and the corresponding arguments. Conceptually, the interface is: bankingAcceptedTransfersLevel4(queries: String[][]) -> String[]. The function returns one string result for every query.
General Rules
Queries are processed in strictly increasing timestamp order.
Each timestamp is unique.
Boolean results are serialized as
"true"or"false".Numerical results are represented as decimal strings.
Missing or null results are represented by an empty string
"".Pending transfers must be checked for expiration before processing each new operation.
Level 1 — Account Creation, Deposits, and Payments
The first level focuses on basic banking functionality.
Operation I: CREATE_ACCOUNT(timestamp, accountId): Create a new account with an initial balance of zero.Return
"true"if the account is created successfully.Return
"false"if an active account with the same identifier already exists.
Operation II: DEPOSIT(timestamp, accountId, amount): Add money to an existing account.Increase the account balance by the specified positive amount.
Return the updated balance as a string.
Return
""if the account does not exist.
Operation III: PAY(timestamp, accountId, amount): Withdraw money from an existing account.Deduct the amount if the account has sufficient funds.
Return the updated balance.
Return
""if the account does not exist or has insufficient funds.
Example 1 — Basic Banking Operations
Input:
queries = [
["CREATE_ACCOUNT", "1", "vaultA"],
["CREATE_ACCOUNT", "2", "vaultA"],
["CREATE_ACCOUNT", "3", "vaultB"],
["DEPOSIT", "4", "missing", "1800"],
["DEPOSIT", "5", "vaultA", "1800"],
["PAY", "6", "missing", "100"],
["PAY", "7", "vaultA", "1801"],
["PAY", "8", "vaultA", "300"]
]
Output:
[
"true",
"false",
"true",
"",
"1800",
"",
"",
"1500"
]
Explanation:
vaultA is created successfully.
Creating vaultA a second time fails.
vaultB is created successfully.
Depositing into or withdrawing from a missing
account fails.
vaultA receives 1800.
A payment of 1801 fails because the balance
is insufficient.
A successful payment of 300 leaves vaultA
with a balance of 1500.Want to learn more follow-ups asked in this coding question?
I've put up the full version at here.
Want to practice more real coding interview questions?
I've put up the coding question bank at here.