Allocate a Fee Across Accounts Without Losing a Cent
Last updated: November 29, 2026
Quick Overview
A management fee must be split across sub-accounts in proportion to their assets, rounded to cents, and the pieces must add up exactly to the total. Explain why binary floats fail here and implement the allocation.
BlackRock
November 29, 20260
0
0 solved
A management fee must be split across sub-accounts in proportion to their assets, rounded to cents, and the pieces must add up exactly to the total. Explain why binary floats fail here and implement the allocation.
Money arithmetic shows up everywhere in Aladdin's accounting and operations, from fee accruals to trade allocations, and rounding pennies wrongly breaks reconciliations. The interviewer checks understanding of floating point representation, decimal types, and the largest remainder method.
What the Interviewer Expects
- Explains that 0.1 has no exact binary representation
- Uses a decimal type with explicit rounding modes
- Allocates the rounding remainder deterministically
- Guarantees the parts sum to the total
- Mentions Java BigDecimal as the equivalent in a Java codebase
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Which account should get the extra cent, and is that fair over many months?
- How would you do the same split for shares, where the unit is one share?
- When is banker's rounding the right choice?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Input: a total such as "100.00" and weights (assets per account). Output: one amount per account, each a multiple of 0.01, summing exactly to the total. Deterministic so reruns match the books....
High-Level Design
Floats store binary fractions, so 0.1 + 0.2 is 0.30000000000000004, and summing many rounded floats drifts by cents. Use Decimal (or BigDecimal in Java) from string inputs. Then apply the larg...