Payment and invoice, split into three parts.
Invoice is always a list, something like ["invoice-id-1, 100, 2022-01-01", "invoice-id-2, 300, 2022-01-01"].
Payment is just one, something like 'payment-id, 300, paying for: invoice-id-1'.
In part one, the payment includes an invoice id, and you're asked to output: "payment-id paid XXX amount for invoice XXX on date XXX"
In part two, the payment no longer has an invoice id, so you need to match by amount to find the corresponding invoice. If multiple invoices match the amount, pick the earliest one. Output format stays the same.
In part three, the amount in the payment might be off, and you're given a forgiveness value — if an invoice's amount is close enough to the payment, that invoice counts as paid too. When outputting, you need to clearly state how much was forgiven.
For every part they ask about test cases. The general idea is that your test cases have to confirm the earlier parts still work correctly, and you need to be clear on the priority order among the different invoice-matching methods — something like "if there's an exact invoice id, don't do amount matching; if there's an exact amount match, don't bother with forgiveness."
Stripe's questions aren't much like LeetCode — they don't focus on algorithms or efficiency. Instead, it's mostly about organizing your objects clearly and writing out the interactions clearly. Honestly, it's basically our day-to-day work.
Don't make things harder for yourself for no reason: use integers instead of floats when you can, and just slice a substring instead of doing regex matching when you can.
Discussion
Loading comments…