Robinhood interview question

algorithm on white board