FastPrepFind Accounts with Negative Converted Balances
Problems/Find Accounts with Negative Converted Balances

Find Accounts with Negative Converted Balances

Stripe logoStripe● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Stripe intern phone screen. The source keeps financial records, currency conversion, and balance checks. It does not give layouts, how rates work, rounding, the output, examples or limits. Our version is about 51% the same as the reported question.

Apply financial records in several currencies and return the accounts whose final balance is negative after conversion to one base unit.

Each conversion rate has the form:

currency,numerator,denominator

An amount in that currency converts to base units as:

amount * numerator / denominator

Each financial record has the form:

account,currency,amount

amount is a signed integer. Every converted record is guaranteed to be exactly divisible by its denominator. Sum converted records independently for each account.

Return the account IDs whose final converted balance is less than zero, sorted in ascending lexicographic order.

Function

accountsWithNegativeBalance(rates: String[], records: String[]) → String[]

Examples

Example 1

rates = ["USD,1,1","EUR,11,10"]records = ["acct_a,USD,100","acct_a,EUR,-100","acct_b,EUR,200","acct_b,USD,-50"]return = ["acct_a"]

acct_a ends at 100 - 110 = -10. acct_b ends at 220 - 50 = 170.

Example 2

rates = ["A,2,1","B,1,2"]records = ["z,B,-8","a,A,-3","z,A,2","a,B,12"]return = []

Both accounts finish at zero, which is not negative.

Constraints

  • 1 <= rates.length <= 100.
  • 1 <= records.length <= 10^5.
  • Account IDs and currency codes are nonempty ASCII strings without commas.
  • Each currency appears exactly once in rates, and every record uses a listed currency.
  • 1 <= numerator, denominator <= 10^6.
  • -10^9 <= amount <= 10^9.
  • Every product amount * numerator and final balance fit in a signed 64-bit integer.

More Stripe Phone Screen questions

  • Split Tender Part 4 - RefundsOA · PHONE SCREEN · Seen Nov 2026
  • Merchant Payout Reserve CalculatorPHONE SCREEN · Seen Nov 2026
  • Parse Boolean Rule ExpressionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Linked Merchants Within Two HopsPHONE SCREEN · Seen Nov 2026
  • Merchant Matching, Parts 1–2: Shared Fields and Weighted ThresholdsPHONE SCREEN · Seen Nov 2026
  • Business Account KYC Verification — Parts 1–5PHONE SCREEN · Seen Nov 2026
  • Financial Account LedgerOA · PHONE SCREEN · Seen Nov 2026
  • Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Merchant Payout Scheduler, Part 2: Per-Merchant SchedulesPHONE SCREEN · Seen Nov 2026
  • Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesPHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Text Embedding and Vector SearchNike, Inc. · PHONE SCREEN · ONSITE INTERVIEW
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEW
  • Group AnagramsWorkday · PHONE SCREEN
  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREEN
  • Time-Aware Search AutocompleteRoblox · PHONE SCREEN
  • Top Ten Most Frequent Words in a BookRobinhood · PHONE SCREEN
  • Group AnagramsEPAM · PHONE SCREEN
  • Aggregate Matching IPv4 Addresses Across ResponsesPinterest · PHONE SCREEN
  • Diff Two Filesystem Hash TreesCursor · PHONE SCREEN
  • Find Duplicate File GroupsAnthropic · PHONE SCREEN
See Stripe hiring insights
Saved
class Solution {
    public String[] accountsWithNegativeBalance(String[] rates, String[] records) {
        // write your code here
    }

}
Checking account…