Problems > Equal Pairs > Editorial

Equal Pairs — Solution & Editorial

Back to the Problem

Frequency map; each value with count c contributes C(c, 2).

Complexity: O(N)

Watch out: Up to ~5×109 pairs — 64-bit counter.