Domanda di colloquio di Amazon

Dynamic programming dsa question which in leet code hard questions