Sliding Window Maximum Leetcode Javascript