Pregunta de entrevista de Jump Trading

Dynamic programming + some language related tricks