Brute Force and Easy Understandable
\nclass Solution {\n\tpublic  static int countPairs(int[] arr, int k) {\n\t\tint n = arr.length;\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\
```\nclass Solution {\n\tpublic  static int countPairs(int[] arr, int k) {\n\t\tint n = arr.length;\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\tif ((arr[i] == arr[j]) && ((i * j) % k == 0)) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}\n```
['Java']