Given an array of integers nums and two integers lower and upper, determine how many subarrays have a sum that falls within the inclusive range [lower, upper].
A subarray sum is computed as the total of elements from index i to j (where i ≤ j).
Your task is to count how many such subarrays produce a sum between the given bounds.
Input: nums = [4, -1, -2, 7], lower = 0, upper = 5
Output: 5
Explanation:
Valid ranges are [4], [4,-1,-2], [-1,-2,7].
Input: nums = [2], lower = 1, upper = 3
Output: 1
Accepted:
Submission: