FastPrepCredit Accounts with Scheduled Transfers
Problems/Credit Accounts with Scheduled Transfers

Credit Accounts with Scheduled Transfers

Airbnb logoAirbnb● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report describes the four levels and the order for merging. We chose the return values, the tie rules, the timing edges and the rules for balance history.

Our version is about 85% the same as the reported question.

You keep track of credit accounts while a list of timed operations comes in. The operations create accounts, add credits, move credits right away, rank accounts by balance, schedule transfers for later, cancel them, merge accounts and look up past balances.

Operation ordering

Process queries in order. Each row holds an operation name, its timestamp and the arguments listed below. These rows are the external operations, as opposed to scheduled transfers, which run on their own. Before each external operation at timestamp t, first run every pending transfer that is due at or before t. Run earlier due times first. If several transfers are due at the same time, run them in the order they were scheduled. Record each scheduled transfer’s balance changes at the time it was due, even if the next external operation happens later.

Return one string for each external query. Write booleans as true or false and numbers as base-10 strings. When an operation that should return a number or an identifier fails, return an empty string.

Accounts and immediate transfers

  • ["CREATE_ACCOUNT", t, id]: create an account with balance zero and return true. Return false if that identifier has ever been created before, even if a merge later removed it.
  • ["ADD_CREDIT", t, id, amount]: add a positive number of credits to an active account and return its new balance. Return the empty string if the account is inactive or does not exist.
  • ["TRANSFER", t, source, target, amount]: move a positive number of credits from the source account to the target account right away. Both must be active, and they must be different accounts. On success, return the source account’s new balance. Return the empty string if either account does not exist or is inactive, if the two identifiers are the same, or if the source does not have enough credits.
  • ["TOP_K", t, k]: rank the active accounts by current credit balance, highest first. Break ties by identifier in ascending order. Return at most k entries, each written as id(balance), joined by commas with no spaces. Return the empty string if there are no active accounts.

Scheduled transfers

  • ["SCHEDULE_TRANSFER", t, source, target, amount, delay]: if the source and target are different active accounts, schedule a transfer for time t + delay. Return its identifier transferK. One counter is shared by all accounts, and it starts at transfer1. An invalid request returns the empty string and does not use up an identifier.
  • Scheduling does not reserve or move any credits. When the transfer is due, it runs only if both accounts are still active and the source has enough credits. Otherwise it is skipped for good. Once a transfer has been processed, it is no longer pending, whether it succeeded or failed.
  • ["CANCEL_TRANSFER", t, source, transferId]: cancel the transfer and return true only if it is still pending and belongs to the active source account. Otherwise return false. Transfers that are due run before the cancel, including transfers due exactly at t.

Merge and balance history

  • ["MERGE_ACCOUNTS", t, survivor, absorbed]: first run due transfers as usual. Return false if the two identifiers are the same or either account is not active. Otherwise add the absorbed account’s balance to the survivor and deactivate the absorbed account. Also cancel every pending transfer that still has the absorbed account as its source or target. Then return true. Pending transfers never reserve funds, so cancelling them does not refund any credits.
  • ["GET_BALANCE", t, id, timeAt]: return that identifier’s balance right after all activity at timeAt. If nothing happened at exactly that time, use its balance after its latest earlier activity. Return the empty string if, at that past time, the account had not been created yet or had already been deactivated. You can still look up a deactivated account’s own balance history from before its merge.
  • The survivor keeps its own history from before the merge. Its combined balance starts at the merge timestamp. The absorbed identifier stops existing at the merge timestamp.

You may also assume the following. Timestamps are strictly increasing. Identifiers are never reused. Transfers move a positive integer number of credits and charge no fees. A failed scheduled transfer is never retried. Past balances follow the rules above for each identifier.

Function

processCreditAccounts(queries: String[][]) → String[]

Examples

Example 1

queries = [["CREATE_ACCOUNT","1","a"],["CREATE_ACCOUNT","2","b"],["ADD_CREDIT","3","a","100"],["ADD_CREDIT","4","b","30"],["TRANSFER","5","a","b","40"],["TOP_K","6","2"]]return = ["true","true","100","30","60","b(70),a(60)"]

The immediate transfer leaves a with 60 and b with 70. TOP_K ranks by these current balances, so b comes first, then a.

Example 2

queries = [["CREATE_ACCOUNT","1","a"],["CREATE_ACCOUNT","2","b"],["CREATE_ACCOUNT","3","c"],["ADD_CREDIT","4","b","100"],["SCHEDULE_TRANSFER","5","b","c","30","5"],["SCHEDULE_TRANSFER","6","b","c","20","10"],["MERGE_ACCOUNTS","10","a","b"],["GET_BALANCE","11","c","10"],["GET_BALANCE","12","b","9"],["GET_BALANCE","13","b","10"],["GET_BALANCE","16","a","16"]]return = ["true","true","true","100","transfer1","transfer2","true","30","100","","70"]

The first scheduled transfer is due at timestamp 10, so it runs before the merge. It leaves b with 70 and c with 30. The merge then moves 70 into a and cancels the second transfer. You can still look up b at timestamp 9, but at timestamp 10 it no longer exists, so that lookup returns the empty string.

Example 3

queries = [["CREATE_ACCOUNT","1","a"],["CREATE_ACCOUNT","2","b"],["ADD_CREDIT","3","a","50"],["SCHEDULE_TRANSFER","4","a","b","40","6"],["SCHEDULE_TRANSFER","5","a","b","30","5"],["CANCEL_TRANSFER","10","a","transfer1"],["TOP_K","11","2"],["GET_BALANCE","12","a","10"]]return = ["true","true","50","transfer1","transfer2","false","b(40),a(10)","10"]

Both scheduled transfers are due at timestamp 10. The one scheduled earlier runs first and succeeds. The second one then lacks funds and is skipped. The cancel request comes after both were processed, so it returns false.

Constraints

  • 1 <= queries.length <= 500.
  • External timestamps are strictly increasing integers from 0 through 10^9.
  • Every query is well formed: a known operation name followed by the arguments listed above. Amounts and delays are positive integers at most 10^9.
  • Account identifiers contain only ASCII letters, digits and underscores, with length from 1 through 32.
  • Every balance, and every due time t + delay, fits in a signed 64-bit integer.
  • For TOP_K, 1 <= k <= 500. For GET_BALANCE, 0 <= timeAt <= t.

More Airbnb Online Assessment questions

  • Count Card Duel RoundsOA · Seen Nov 2026
  • Count Lamps Lighting Each PointOA · Seen Nov 2026
  • Simulate Orchard Rot SpreadOA · Seen Nov 2026
  • Sort Adjacent PairsOA · Seen Nov 2026
  • In-Memory File SystemOA · Seen Nov 2026
  • Task Management SystemOA · Seen Nov 2026
  • Recipe Management SystemOA · Seen Nov 2026
  • Progressive Banking SystemOA · Seen Nov 2026
  • Parcel Attribute Store with TTLOA · Seen Oct 2026
  • Parcel Event TrackingOA · Seen Oct 2026

Similar questions at other companies

  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions
  • Interview Slot BookingTrueFoundry · PHONE SCREEN
  • Power Cell BankOptiver · OAOptiver interview questions
  • Four-Level Banking System with Scheduled PaymentsZipRecruiter · OAZipRecruiter interview questions
  • Task Management SystemCoinbase · OACoinbase interview questions
  • Task Management SystemAnthropic · OAAnthropic interview questions
  • Progressive Parcel Tracking OperationsKlaviyo · OAKlaviyo interview questions
  • Versioned Recipe SystemThe Trade Desk · OA
  • Recipe Management SystemRamp · OARamp interview questions
  • Macaron Order with Set DiscountsShopify · OAShopify interview questions

Interview reports that mention this question

  • Airbnb SWE CodeSignal OA: 19 Experiences

Airbnb interview experiences

  • Airbnb OA · November 2026
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
  • Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
  • Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public String[] processCreditAccounts(String[][] queries) {
        // Write your code here.
    }
}
Checking account…