Bloomberg interview question

2 Leetcode Medium questions in a shared hackerrank