Pergunta de entrevista da empresa Google

Dynamic programming question with a 2d array