Pregunta de entrevista de Squarepoint Capital

Leetcode question, a practical guild to quantitative finance interviews