Pregunta de entrevista de AKUNA CAPITAL

Some sort of dynamic programming question