FastPrepAccount Balance Manager Part 1 - Calculate Totals
Problems/Account Balance Manager Part 1 - Calculate Totals

Account Balance Manager Part 1 - Calculate Totals

Stripe logoStripe● EasyFULLTIMENEW GRADINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This practice version matches the reported core task at about 80%. The internship author directly links a report requiring nonzero per-account totals from signed transaction rows. This exercise preserves that result and corrects inconsistent account labels from the input. The two-field runner, ordering, numeric bounds, and edge cases are practice choices; the source uses four fields.

Practice sequence

  1. Part 1: Calculate Totals (you are here)
  2. Part 2: Reject Overdrafts
  3. Part 3: Platform Coverage

Transaction format

Rows use account_name,timestamp,currency,amount. They are chronological and use one currency. Positive amounts add money and negative amounts withdraw money.

Rules

For this exercise, assume transactions arrive in order as account_id,amount strings. A positive amount is a deposit and a negative amount is a withdrawal.

Process every transaction and calculate each account's final balance. Return every account whose final balance is nonzero. This includes both positive and negative balances; omit only accounts whose final balance is exactly 0. Format each result as account_id:balance and sort the results lexicographically by account identifier.

The runner projects each chronological, single-currency source row to account_id,amount. Timestamps and currency are omitted; do not infer sorting or currency-conversion behavior. The existing callable return format defines the judged task.

Worked example

Each row has four fields:

account_name,timestamp,currency,amount
acct_123,1,usd,1000
acct_123,2,usd,500
acct_321,3,usd,400
acct_321,4,usd,-400

Adding the signed amounts gives acct_123:1500; acct_321 ends at zero and is omitted.

Function

getAccountBalances(transactions: String[]) → String[]

Examples

Example 1

transactions = ["account_A,100", "account_B,50", "account_A,-30", "account_C,200", "account_B,-50", "account_D,-25"]return = ["account_A:70", "account_C:200", "account_D:-25"]

account_A ends at 70, account_B ends at 0, account_C ends at 200, and account_D ends at -25. The nonzero balances for account_A, account_C, and account_D are returned in lexicographic account order; only account_B is omitted.

Example 2

transactions = []return = []

An empty transaction list yields no accounts.

Example 3

transactions = ["acct_123,1000","acct_123,500","acct_321,400","acct_321,-400"]return = ["acct_123:1500"]

The second account’s 400 deposit and 400 withdrawal cancel; the first account receives 1000+500. Only its nonzero balance is returned.

Constraints

  • Each transaction is "account_id,amount"; amount is an integer (positive deposit, negative withdrawal).
  • Process transactions in the given order, summing every amount for its account.
  • Return every account whose final balance is not 0, including accounts with negative final balances.
  • Omit an account only when its final balance is exactly 0.
  • Output entries are "account_id:balance" sorted lexicographically by account_id.
  • For this practice domain, parsed amounts, all intermediate additions, balances, and negated shortfalls fit in a signed 64-bit integer. Account identifiers are nonempty ASCII strings without commas or colons.

Source note: The supplied onsite screenshot explicitly says to print balances where balance != 0 before producing a rejection list.

More Stripe Onsite Interview questions

  • Render a Task Tree from CSV RowsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Parse Boolean Rule ExpressionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Transaction Rule Expression EvaluatorONSITE INTERVIEW · Seen Oct 2026
  • Evaluate Ordered Action RulesPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • WebSocket Load Balancer — Parts 1–5OA · ONSITE INTERVIEW · Seen Sep 2026
  • Rule-Driven Transaction Fraud DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Account Balance Manager Part 3 - Platform CoverageONSITE INTERVIEW · Seen May 2026
  • Account Balance Manager Part 2 - Reject OverdraftsONSITE INTERVIEW · Seen May 2026
  • Merge and Filter Prioritized ConfigurationsONSITE INTERVIEW · Seen Apr 2026

Similar questions at other companies

  • Card Transaction StreamCapital One · ONSITE INTERVIEWCapital One interview questions
  • Feature Flags with Rules, Dependencies and ExposurePerplexity AI · ONSITE INTERVIEWPerplexity AI interview questions
  • In-Memory Vault File SystemHarvey · ONSITE INTERVIEWHarvey interview questions
  • Generate Word Guess FeedbackAtlassian · ONSITE INTERVIEWAtlassian interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Stable Unique Column RenamesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Most Frequent Call Path in Interleaved LogsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Dictionary Records to an Editable XML TreeSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Autocomplete SystemPinterest · ONSITE INTERVIEWPinterest interview questions

Interview reports that mention this question

  • Stripe SWE Internship Account Balance and Bikemap Onsite
  • Stripe New Grad Coding Patterns, 2026 Guide
  • Stripe New Grad Interview Question Bank: 47 Problems
  • Stripe New Grad Screens and Onsites: 9 Experiences (Part 2 of 2)

Stripe interview experiences

  • Stripe SWE Onsite over Two Days: 1 Experience
  • Stripe New Grad SWE Phone Screen and Onsite: 2 Experiences
All Stripe interview questionsSee Stripe hiring insights
Saved
class Solution {
    public String[] getAccountBalances(String[] transactions) {
      // write your code here
    }
}
Checking account…