Bloomberg Interview Question

Solve a coding question leetcode medium