Back to problems

Match payments to invoices by memo or amount

Algorithm · Google · Medium

You are given two record sets: invoices and payments. Each invoice contains a unique string invoice_id, an integer amount_cents, and an ISO-8601 date string due_date such as YYYY-MM-DD. Each payment contains a string payment_id, an integer amount_cents, and a memo string that may be empty, None, or include extra surrounding whitespace. A memo may contain a standardized reference of the form "Paying off: ". When this prefix is present, extract the text after it and trim…

Checking your access…