Solution in C++
IntuitionGiven a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where 0 <= i < j < n, such that nums[i] == nums[j]
# Intuition
Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where 0 <= i < j < n, such that nums[i] == nums[j] and (i * j) is divisible by k.

# Approach
Iterate through the array: Use a nested loop to examine all pairs
(i,j) where i<j.

Check equality: For each pair, check if nums[i]==nums[j].

Check divisibility: If the above condition holds true, compute the product 𝑖⋅𝑗 and check if it is divisible by 𝑘.

Count valid pairs: If both conditions are satisfied, increment the counter.

# Complexity
- Time complexity:
The solution involves two nested loops, leading to a time complexity of 𝑂(𝑛^2), where 𝑛 is the size of the input array.

- Space complexity:
The solution uses a constant amount of extra space, leading to a space complexity of 𝑂(1).

# Code
```cpp []
class Solution {
public:
    int countPairs(vector<int>& nums, int k) {
        int s=0;
        for(int i=0;i<nums.size();i++){
            int is=1;
            for(int j=i+1;j<nums.size();j++){
                if(nums[i]==nums[j]){
                    is=i*j;
                    if(is%k==0){
                        s++;
                    }
                }
            }
        }
        return s;
    }
};
```
['C++']