Adyen interview question

Basic dynamic programming problem, an sql problem and a design problem.