Pergunta de entrevista da empresa Fractal

LC Dynamic Programming Medium level question