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
Coding & Algorithms
Software Engineer
Patreon
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

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
integer money math
rounding
refund modeling
hash map lookup
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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, ...


Submit Your Answer
Markdown supported

Related Questions