Bloomberg Interview Question

It was a Coding Problem about Algorithms