weights and two bounds low and high. Count the index pairs (i, j) with i < j for which weights[i] + weights[j] lies between low and high, inclusive.weights=[3, 9, 4, 6, 1], low=7, high=10 → 5
The pairs 3+4, 3+6, 9+1, 4+6 and 6+1 fit, five in total.
weights=[2, 2, 2], low=4, high=4 → 3
Any two of the three values sum to 4: three pairs.
weights=[-5, 5], low=1, high=3 → 0
weights=[3, 9, 4, 6, 1], low=7, high=10
5
Run checks the first 3 tests in your browser. Submit checks all 86 tests on the server, hidden ones included.