Minimum Account Settlements
Reported by candidates from Rippling's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The whole Rippling problem hangs on a hash map of net balances. That's the data structure, and everything after it is search. If you've got a Rippling OA coming off the July 2026 reports, expect Minimum Account Settlements: [from, to, amount] rows, and you return the fewest transfers that zero everyone out. The interviewer reportedly asked for any valid settlement first, then for the minimum. The constraint of at most 12 people with non-zero balances is the giveaway that backtracking is intended. StealthCoder sits invisible on your screen as a safety net if you blank on the recursion during the live OA.
The problem
Each row of transactions is [from, to, amount], meaning from paid amount on behalf of to. After all original transactions, people may transfer money among themselves to settle every net balance. A person with a negative balance must pay that amount; a person with a positive balance must receive that amount. Return the minimum number of settlement transactions required to make every net balance zero. Interviewer follow-ups The interviewer first asked for any correct set of transfers that settles all accounts, then asked the candidate to minimize the number of settlement transactions. Function minimumSettlements(transactions: String[][]) → int Examples Example 1 transactions = [["A","B","10"],["B","C","5"]] return = 2 The net balances are A:+10, B:-5, and C:-5. Both B and C must pay A, so two settlements are necessary. Example 2 transactions = [["A","B","10"],["B","C","10"]] return = 1 B's incoming and outgoing amounts cancel. One transfer from C to A settles everyone. Constraints 1 <= transactions.length <= 100 amount is a positive integer string. At most 12 people have non-zero final balances.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Step one: build a hash map of net balance per person. Sign convention matters, so check it against the examples: A:+10, B:-5, C:-5 means two settlements. Drop everyone at zero, since they need no transfers. Step two: put the remaining balances in a list and run DFS with backtracking. Take the first non-zero balance, try pairing it with each later balance of opposite sign, add the first onto the second, recurse, then undo. Count transfers and keep the minimum. Pitfalls: forgetting to skip zeros, forgetting to undo the change, and not pruning duplicate balances. With 12 people this is fine. A bitmask DP over subsets is the faster alternative, maximizing the number of zero-sum groups. The answer is n minus that count. If you freeze on the undo step during the live OA, StealthCoder is the hedge that gives you the working structure.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Minimum Account Settlements 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as optimal account balancing. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Rippling's OA.
Rippling reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Account Settlements FAQ
What's the trick in Rippling's Minimum Account Settlements?+
Collapse all transactions into net balances per person with a hash map, discard zeros, then backtrack. Only the net balances matter, not who paid whom originally. The search tries pairing one debtor with one creditor at a time and tracks the minimum transfer count.
How hard is this one really?+
It's a hard-leaning medium. The balance step is easy. The backtracking with undo and pruning is where people stumble. The 12-person cap tells you exponential search is expected, so don't hunt for a greedy shortcut. Greedy matching of largest debtor to largest creditor fails on some inputs.
Why not just match the biggest debtor with the biggest creditor?+
Greedy gives a valid settlement but not always the minimum. The interviewer's first follow-up, any correct set of transfers, is satisfied by greedy. The second, minimum count, needs you to find zero-sum subgroups, which requires backtracking or bitmask DP.
Is the backtracking or the bitmask DP better here?+
Backtracking is simpler to write under pressure and fits 12 people. Bitmask DP is cleaner on complexity: find the most disjoint zero-sum subsets, and the answer is people minus groups. Pick the one you can code without bugs. Either passes the stated constraint.
How do I prepare for this in 48 hours?+
Write the net balance map, then the DFS with undo, twice from scratch. Test on both examples: expected outputs are 2 and 1. Add a case where balances are all zero and expect 0. Also practice parsing amounts from strings, since the input amounts are strings, not ints.