Subarray Range With Given Sum Leetcode Problems Javascript For Loop