Pergunta de entrevista da empresa Two Sigma

Medium difficulty algorithm + OOP design and implementation of it