C++ easy to understand solution | brute force
\nclass Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) {\n        int n = nums.size();\n        int cnt = 0;\n        for(int i = 0;i<n;i++){
```\nclass Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) {\n        int n = nums.size();\n        int cnt = 0;\n        for(int i = 0;i<n;i++){\n            for(int j = i+1;j<n;j++){\n                if(nums[i] == nums[j]){\n                    if((i*j)%k == 0)cnt++;\n                }\n            }\n        }\n        return cnt;\n    }\n};\n```
[]