FastPrepProcess Banking Operations
Problems/Process Banking Operations

Process Banking Operations

Vercel logoVercel● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Our version is about 55% the same as the reported question. The interview report names a time-limited banking system exercise that grows in steps. The finite operations, integer results, rules for invalid operations, and limits are our assumptions.

You are given a list of banking operations. Process them in order and keep track of each account's balance. Each operation is a string array.

  • ["CREATE", account] makes a new account with a balance of zero and returns 1. If the account already exists, it returns 0.
  • ["DEPOSIT", account, amount] adds a positive amount to the account and returns the new balance. It returns -1 if the account does not exist.
  • ["TRANSFER", from, to, amount] moves a positive amount from one account to a different account. It returns the source account's new balance. It returns -1 if either account does not exist, if the two accounts are the same, or if the source account does not have enough money.
  • ["BALANCE", account] returns the current balance, or -1 if the account does not exist.

Return one integer for each operation, in the same order as the input. A rejected operation does not change any balance.

Function

processBankingOperations(operations: String[][]) → long[]

Examples

Example 1

operations = [["CREATE","alice"],["DEPOSIT","alice","20"],["BALANCE","alice"]]return = [1,20,20]

Creating alice succeeds. The deposit is the first money in alice, so its new balance equals the deposit amount. Reading the balance returns that same amount. This gives the output shown.

Example 2

operations = [["CREATE","a"],["CREATE","b"],["DEPOSIT","a","9"],["TRANSFER","a","b","4"],["TRANSFER","a","b","8"],["BALANCE","b"]]return = [1,1,9,5,-1,4]

Both accounts are created, and the deposit puts nine in a. The first transfer moves four from a to b. That leaves five in a and four in b, so it returns five. The second transfer asks for eight, but a only has five. It is rejected and no balance changes. The balance of b is still four.

Constraints

  • 1 <= operations.length <= 100000
  • Account names are nonempty strings of letters and digits with length at most 40.
  • Transaction amounts are decimal integers between 1 and 1000000000.
  • Every balance fits in a signed 64-bit integer.
  • Each operation has exactly the fields shown in the statement.

More Vercel interview questions

  • Order DAG Nodes from Leaves to RootsONSITE INTERVIEW · Seen Sep 2026
  • Recent Metrics by Name and TagsPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Parcel Attribute Store with TTLAirbnb · OAAirbnb interview questions
  • Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Process On-Call Routing OperationsOpenAI · PHONE SCREENOpenAI interview questions
  • Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
  • Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Role-Based Network Access ControlOkta · PHONE SCREENOkta interview questions
  • Track Package Receipt GapsAmazon · PHONE SCREEN
  • Transformer KV Cache OperationsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Rate Limiter with Hourly and Daily Effort QuotasZscaler · PHONE SCREENZscaler interview questions
See Vercel hiring insights
Saved
class Solution {
    public long[] processBankingOperations(String[][] operations) {
        // Write your code here.
    }

}
Checking account…