Bloomberg interview question

Leetcode medium hard questions on hackerrank