Bloomberg Interview Question

It was an easy level leetcode question.