Pregunta de entrevista de Nielsen

DSA question from dynamic programming