Tap here to switch tabs
Problem
Submissions

Problem: Count of Range Sum

Try to solve the Count of Range Sum problem.

Statement

Given an integer array nums and two integers lower and upper, return the number of range sums that lie within the inclusive interval [[lower, upper]].

A range sum S(i,j)S(i, j) is defined as the sum of the elements in nums from index i to index j inclusive, where 0≤i≤j<0 \leq i \leq j < nums.length.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −231≤-2^{31} \leq nums[i] ≤231−1\leq 2^{31} - 1

  • −105≤-10^5 \leq lower ≤\leq upper ≤105\leq 10^5

  • The answer is guaranteed to fit in a 3232 bit integer.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count of Range Sum

Try to solve the Count of Range Sum problem.

Statement

Given an integer array nums and two integers lower and upper, return the number of range sums that lie within the inclusive interval [[lower, upper]].

A range sum S(i,j)S(i, j) is defined as the sum of the elements in nums from index i to index j inclusive, where 0≤i≤j<0 \leq i \leq j < nums.length.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −231≤-2^{31} \leq nums[i] ≤231−1\leq 2^{31} - 1

  • −105≤-10^5 \leq lower ≤\leq upper ≤105\leq 10^5

  • The answer is guaranteed to fit in a 3232 bit integer.