Equivalent Pairs
You are given a list of integers nums. Return the number of pairs i < j such that nums[i] = nums[j].
Constraints
0 ≤ n ≤ 100,000wherenis the length ofnums
https://binarysearch.com/problems/Equivalent-Pairs
Examples
Example 1
Input
- nums =
[3, 2, 3, 2, 2]
Output
- answer =
4
Explanation
We have index pairs (0, 2), (1, 3), (1, 4), (3, 4).
Leave a comment