Pergunta de entrevista da empresa Amazon

A 2d dp problem comprising of dp, index and sum