Compute A Creator's Net Earnings After Fees And Refunds
Last updated: November 29, 2026
Quick Overview
Given a month of pledge charges and refunds in integer cents, compute what a creator nets after Patreon's platform fee and a 2.9% plus 30 cent processing fee. Refunds return the platform fee pro rata but not the processing fee.
Patreon
November 29, 20260
0
0 solved
Given a month of pledge charges and refunds in integer cents, compute what a creator nets after Patreon's platform fee and a 2.9% plus 30 cent processing fee. Refunds return the platform fee pro rata but not the processing fee.
A warm-up in the style of a Patreon payments or creator-earnings phone screen. The interviewer checks that you handle money as integer cents, round deterministically, and model refunds against the original charge rather than as negative charges.
What the Interviewer Expects
- Uses integer cents, never floats, for every amount
- States a rounding rule (round half up) and applies it consistently
- Looks up the original charge when processing a refund
- Handles partial refunds with a pro rata platform fee return
- Rejects refunds larger than what remains on the charge
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 support multiple currencies with different minor units, such as JPY with zero decimals?
- A chargeback costs an extra $15 dispute fee and the platform fee is not returned. How does the code change?
- How would you make the per-charge breakdown auditable for the creator earnings page?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a list of transactions. A charge has an id and amount_cents. A refund references charge_id and may carry a partial amount_cents (defaults to the full remaining amount). Platform fee...
High-Level Design
Walk transactions in order. For each charge, compute both fees, store (remaining_amount, remaining_platform_fee) keyed by id, and add amount - fees to the total. For a refund, look up the charge, ...