Pregunta de entrevista de Optiver

Dynamic Programming Leetcode style question