Two Subarrays Leetcode Javascript Practice