Description
Solutions
Range Sum
π€ INTERNπRELATED PROBLEMS
Return the number of range sums that lie in [lower, upper]
inclusive.
Example 1:
Input: arr = [-2, 5, -1], lower = -2, upper = 2
Output: 3
Explanation:There are three ranges with sums that fall within the range [-2, 2]: 1. [-2] with sum -2 2. [-2, 5, -1] with sum 2 3. [-1] with sum -1
Example 2:
Input: arr = [1, -3, 5, 2, 5, 2, -5], lower = -2, upper = 6
Output: 8
Explanation:There are eight ranges with sums that fall within the range [-2, 6].
Example 3:
Input: arr = [1, -3, 5, -2, 2, 5, -1, 10], lower = 5, upper = 9
Output: 12
Explanation:There are twelve ranges with sums that fall within the range [5, 9].
Constraints:
ππ

Related Problems
Testcase
Result
Case 1
input:
output: