Special Array Ii Leetcode Javascript Question