Two Sigma interview question

Medium difficulty algorithm + OOP design and implementation of it