Pregunta de entrevista de Two Sigma

Medium difficulty algorithm + OOP design and implementation of it