Special Array Ii Leetcode Problems Javascript