# ---
# title: 327. Count of Range Sum
# id: problem327
# author: Tian Jun
# date: 2020-10-31
# difficulty: Hard
# categories: Binary Search, Divide and Conquer, Sort, Binary Indexed Tree, Segment Tree
# link: <https://leetcode.com/problems/count-of-range-sum/description/>
# hidden: true
# ---
# 
# Given an integer array `nums`, return the number of range sums that lie in
# `[lower, upper]` inclusive.  
# Range sum `S(i, j)` is defined as the sum of the elements in `nums` between
# indices `i` and `j` (`i` ≤ `j`), inclusive.
# 
# **Note:**  
# A naive algorithm of _O_ ( _n_ 2) is trivial. You MUST do better than that.
# 
# **Example:**
# 
#     
#     
#     Input: _nums_ = [-2,5,-1], _lower_ = -2, _upper_ = 2,
#     Output: 3 
#     Explanation: The three ranges are : [0,0], [2,2], [0,2] and their respective sums are: -2, -1, 2.
#     
# 
# 
# 
# **Constraints:**
# 
#   * `0 <= nums.length <= 10^4`
# 
# 
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end
