Increase Subarray Javascript Interview Question