Pregunta de entrevista de Hudson River Trading

LC hard question multiple steps optimization