Bloomberg interview question

leetcode problem number two hundred and forty three