Bloomberg interview question

Data Structure problem, and 1 leetcode medium question