System Design Problem Leetcode Javascript