All Posts
Leetcode 2563: Count the Number of Fair Pairs
Given an integer array nums of size n and two integers lower and upper, find the number of fair pairs. A pair (i, j) is considered fair if it satisfies the following conditions:
0 <= i < j < nlower <= nums[i] + nums[j] <= upper
Return the number of such pairs.