Subarray Questions On Leetcode Javascript Question