Amazon interview question

I got questions from Stack, dynamic programming