← Questions
Register and sell card receivables
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in Stripe's technical phone screen, last asked Nov 2024. It tests hash map, aggregation and csv.
In Brazil, card sales are registered as receivables: money a merchant will be paid on a given date for a given card network. You get a CSV of transactions (customer, merchant, payout date, card type, amount) and a CSV of contracts in which a lender buys a merchant's receivable (contract ID, merchant, payout date, card type, amount).
- Sum the transactions into one receivable per merchant, card type and payout date, and print them as CSV sorted by ID, card type, date and amount.
- Apply the contracts: each one takes over the matching merchant receivable, which is then listed under the contract's ID instead.
- A contract may buy only part of a receivable: list the contract's share under its ID and keep the rest under the merchant, dropping the merchant row when nothing is left.
Clarifying questions
- In part 1, is the receivable's "ID" the merchant id?
- Does a contract match on merchant, payout date and card type exactly? What if it is larger than the receivable, or matches none?
- Can several contracts buy parts of the same receivable?
- Are amounts integer cents or decimals, and what exact CSV output is expected?
- Is the date format fixed, so dates can be sorted correctly?
What a strong answer covers
- Reads both files with a CSV parser and holds amounts as integer cents or decimals, never floats.
- Groups transactions into a map keyed by
(merchant, card type, payout date). - Applies contracts in order: takes the contract's amount from the matching receivable, adds a row under the contract id, and drops the merchant row once it reaches zero; states what happens to oversized or unmatched contracts.
- Sorts with one tuple key (id, card type, date, amount), with dates parsed so they sort in time order.
- Tests per part with small files, including headers and stray whitespace.
Follow-ups
- A contract covers a range of payout dates, or every card type.
- A contract is cancelled and its amount goes back to the merchant.
- Files too large to fit in memory.
Where it's asked
- Stripe · Technical phone screen · Last asked Nov 202460 min · One realistic task in parts, in a project editor (CoderPad project mode or HackerRank Projects) with several files and tests
What it tests
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
