Bloomberg Interview Question

coding challenge