Pergunta de entrevista da empresa MindTickle

Hard level question on Dynamic Programming.