Bloomberg interview question

It was an easy level leetcode question.