Reported April 2026
Ripplinghash table

Driver Balance Ledger

Reported by candidates from Rippling's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Rippling OA. Under 2s to a working solution.
Founder's read

Rippling reported this one in April 2026, and it looks friendlier than it is. Driver Balance Ledger is a hash map plus one running number. The whole problem reduces to keeping a cached total in sync so TOTAL never scans drivers. If you're taking this OA in the next day or two, the logic is short, but the details can bite you. Parsing strings into longs, unseen drivers defaulting to 0, and 2 * 10^5 operations all matter. StealthCoder is the safety net on the live OA if you blank, but you should be able to write this cold after reading it.

The problem

Maintain an in-memory balance ledger for delivery drivers. Process each operation in order:
["ADJUST", driverId, delta]: add the signed integer delta to the driver's current balance. A driver has balance 0 before the first adjustment.
["BALANCE", driverId]: append the driver's current balance to the result. An unseen driver has balance 0.
["TOTAL"]: append the sum of every driver's current balance to the result.
Only BALANCE and TOTAL operations produce output. Return those values in operation order.
The total-balance operation may be called very frequently, so it should not scan every driver on each call.

Function
processDriverBalances(operations: String[][]) → long[]

Examples
Example 1
operations = [["ADJUST","alice","1200"],["ADJUST","bob","800"],["TOTAL"],["BALANCE","alice"],["ADJUST","alice","-300"],["TOTAL"]]
return = [2000,1200,1700]
After the first two adjustments, the total is 1200 + 800 = 2000. Alice's balance is 1200. Her final adjustment lowers both her balance and the cached total by 300, so the last result is 1700.
Example 2
operations = [["BALANCE","d7"],["TOTAL"],["ADJUST","d7","-50"],["BALANCE","d7"],["TOTAL"]]
return = [0,0,-50,-50]
An unseen driver starts at 0, and an empty ledger also totals 0. Signed adjustments may make a balance and the overall total negative.
Example 3
operations = [["ADJUST","a","5"],["ADJUST","a","-5"],["ADJUST","b","9"],["TOTAL"],["BALANCE","a"],["BALANCE","b"]]
return = [9,0,9]
Repeated adjustments accumulate for the same driver. Driver a returns to 0, while driver b contributes the entire total of 9.

Constraints
1 <= operations.length <= 2 * 10^5.
Each operation has one of the documented forms.
Each driverId contains 1 to 40 ASCII letters, digits, hyphens, or underscores.
Each delta is a decimal integer string between -10^9 and 10^9, inclusive.
Every individual driver balance and the total balance fit in a signed 64-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Keep a HashMap from driverId to long balance and a single long called total. On ADJUST, parse delta as a long, add it to the driver's balance using getOrDefault(id, 0), and add the same delta to total. On BALANCE, append the map value or 0 for unseen drivers. On TOTAL, append total directly. Every operation is O(1), so the whole run is O(n). The pitfalls are small but real. Use long everywhere, not int, because balances can exceed 32 bits. Don't create map entries on BALANCE lookups unless you want to, since it changes nothing but wastes memory. Remember the output only includes BALANCE and TOTAL results, not ADJUST. The naive solution sums the map on every TOTAL and times out. If you freeze on the live OA, StealthCoder can surface this pattern, but the cached-total idea is the whole trick.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Driver Balance Ledger cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Rippling's OA.

Rippling reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Driver Balance Ledger FAQ

What's the trick in the Rippling Driver Balance Ledger problem?+

Maintain a running total alongside the per-driver map. Every ADJUST updates both the driver's balance and the total by the same delta. TOTAL then returns the cached value in O(1) instead of summing all drivers, which would be too slow at 2 * 10^5 operations.

How hard is this OA question really?+

Easy. It's a design-flavored hash map problem with no tricky algorithm. The difficulty is in details: parsing signed strings, using 64-bit integers, defaulting unseen drivers to 0, and only outputting results for BALANCE and TOTAL operations.

Do I need int or long for balances?+

Use long. Each delta can be up to 10^9 in magnitude, and many adjustments accumulate, so a balance or total can overflow 32 bits. The problem guarantees values fit in signed 64-bit, so long is safe for both the map values and the total.

What happens with a driver that was never adjusted?+

Their balance is 0. A BALANCE query on an unseen driver appends 0, and an empty ledger's TOTAL is also 0. Use getOrDefault or an equivalent so you don't throw a null error or skip appending an output.

How do I prepare for this in 48 hours?+

Write it once from scratch in your language of choice. Practice parsing strings to long and building a result list from mixed operation types. Then test the three examples, especially the negative total and the balance returning to zero cases.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Rippling.

OA at Rippling?
Invisible during screen share
Get it