Track Per-Chain USDC Circulating Supply From Mint And Burn Events
Last updated: November 29, 2026
Quick Overview
Given an ordered stream of (chain, kind, amount) events where kind is mint or burn, compute circulating USDC supply per chain and in total, and report any event that is invalid, such as a burn larger than that chain's supply.
Circle
November 29, 20260
0
0 solved
Given an ordered stream of (chain, kind, amount) events where kind is mint or burn, compute circulating USDC supply per chain and in total, and report any event that is invalid, such as a burn larger than that chain's supply.
A short online-assessment style task grounded in how Circle reports USDC supply across many chains and compares it against reserves. The interviewer looks for clean aggregation, defensive handling of impossible events, and integer amounts.
What the Interviewer Expects
- Uses a hash map keyed by chain with integer base units
- Detects burns that would make a chain's supply negative instead of silently going below zero
- Reports anomalies with enough context (index, chain, reason) to investigate
- Handles unknown event kinds and non-positive amounts
- Keeps a single pass over the events
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you extend this to check that total supply never exceeds attested reserves?
- Events arrive out of order across chains; does that change the per-chain check?
- How would you make this incremental for a live dashboard instead of a batch recompute?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Each event is
(chain, kind, amount)withamountin integer base units and events in order per chain. - Output: supply per chain, total supply, and a list of anomalies.
- An anomaly should not be...
High-Level Design
Keep a defaultdict(int) of supply per chain. Mints add, burns subtract after checking there is enough supply on that chain. Anything invalid is skipped and recorded with its index so an operator can...