Domanda di colloquio di Amazon

I had a dynamic programming question