Sliding Window Maximum Leetcode Javascript Question