Pergunta de entrevista da empresa Salesforce

Asked 2d dynamic programming question.