Shopee Interview Question

Data structure medium level as found on leetcode