Amazon Interview Question

I forget the coding questions they asked me. I remember I answered it with dynamic programming though