Easy Java Solution || O(n^2) but easy and clean code
\nclass Solution {\n    public int countPairs(int[] nums, int k) {\n        int res = 0;\n        for(int i=0; i<nums.length; i++){\n            for(int j=i+1; 
```\nclass Solution {\n    public int countPairs(int[] nums, int k) {\n        int res = 0;\n        for(int i=0; i<nums.length; i++){\n            for(int j=i+1; j<nums.length; j++){\n                if(nums[i] == nums[j] && (i*j)%k == 0)\n                    res++;\n            }\n        }\n        return res;\n    }\n}\n```
[]