Count Pairs With Sum

Medium · rating 1350 · Hashing, Arrays

The first line has n and target t. The second line has n integers. Print the number of index pairs (i, j) with i < j and ai + aj = t.

Constraints: 1 ≤ n ≤ 105

Related problems

Open Count Pairs With Sum in Code Arena →