Pregunta de entrevista de MindTickle

Hard level question on Dynamic Programming.