Bloomberg Interview Question

Leetcode style problem - data structures related