TikTok Interview Question

Match payments to invoices with fallback rules