Bloomberg Interview Question

leetcode easy problem-not too bad