← ALL NOTES
Array

2563. Count the Number of Fair Pairs

Given nums and bounds lower, upper, a pair (i, j) with i < j is fair if lower ≤ nums[i] + nums[j] ≤ upper. Count the fair pairs. Since a pair sum doesn't depend on order, sort the array and count…

Loading…