Bloomberg interview question

coding challenge