Pregunta de entrevista de Two Sigma

It was a coding question..