← Questions
Payment ledger with partial refunds and date queries
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Build a small payment ledger driven by text commands:
- record a payment with an ID, a UTC timestamp and an amount, rejecting a malformed timestamp or a duplicate ID;
- refund part or all of a payment, any number of times, never more than it was worth in total;
- report net revenue (payments minus refunds);
- list the IDs of payments made on a given date, or between two dates, in the order they were recorded, rejecting malformed dates.
Return one result for each command. A fully refunded payment still shows up in date queries. Think about how to index payments by date so the queries don't scan everything.
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
