Amazon Interview Question

I got questions from Stack, dynamic programming