Smartpay Payments interview question

An algorithm challenge and a data structures challenge