Equal Pairs — Solution & Editorial
Frequency map; each value with count c contributes C(c, 2).
Complexity: O(N)
Watch out: Up to ~5×109 pairs — 64-bit counter.
Frequency map; each value with count c contributes C(c, 2).
Complexity: O(N)
Watch out: Up to ~5×109 pairs — 64-bit counter.