Given an integer array nums and two integers lower and upper, count how many index pairs (i, j) satisfy all of the following:
the indices are distinct with i < j, and the sum nums[i] + nums[j] lies within the inclusive range from lower to upper.
Return the total number of such pairs.
Constraints:
nums.length
nums.length n
nums[i]
lower upper
Given an integer array nums and two integers lower and upper, count how many index pairs (i, j) satisfy all of the following:
the indices are distinct with i < j, and the sum nums[i] + nums[j] lies within the inclusive range from lower to upper.
Return the total number of such pairs.
Constraints:
nums.length
nums.length n
nums[i]
lower upper