Continuous Subarrays Leetcode Javascript