Array Based Leetcode Problems Javascript Map