https://leetcode.com/problems/count-equal-and-divisible-pairs-in-an-array/



Runtime: 519 ms, faster than 6.38% of TypeScript online submissions for Count Equal and Divisible Pairs in an Array.

Memory Usage: 50.3 MB, less than 6.38% of TypeScript online submissions for Count Equal and Divisible Pairs in an Array.



```typescript
function countPairs(nums: number[], k: number): number {
    //8:59
    let pairs = []
    for (const [i, i_value] of nums.entries()) {
        for (const [j, j_value] of nums.entries()) {
            if (i != j) {
                if (i_value === j_value) {
                    if (((i * j) % k) === 0) {
                        let new_pair = [i,j]
                        new_pair.sort((a,b) => a-b)
                        let found = pairs.filter((pair) => (pair[0] === new_pair[0]) && (pair[1] === new_pair[1]))
                        if (found.length === 0) {
                            pairs.push(new_pair)
                        }
                    }
                }
            }
        } 
    }
    return pairs.length
    //9:02
    //debug until 9:18
};
```
