C++ solution || Beginner friendly
\nclass Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) {\n        int res = 0;\n        for(int i=0; i<nums.size(); i++) {\n            for(i
```\nclass Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) {\n        int res = 0;\n        for(int i=0; i<nums.size(); i++) {\n            for(int j=i+1; j<nums.size(); j++) {\n                if(nums[i] == nums[j] && ((i*j) % k == 0)) {\n                    res++;\n                }\n            }\n        }\n        return res;\n    }\n};\n```
['C']