Bloomberg Interview Question

There was no OA, and the interview was a leetcode medium.