Simple JS solution complexity:54 ms && 41 MB
\n Describe your approach to solving the problem. \n\n\n# Complexity\n- Time complexity: \n Add your time complexity here, e.g. O(n) \n\n- Space complexity:\n A
\n<!-- Describe your approach to solving the problem. -->\n![image.png](https://assets.leetcode.com/users/images/9c47a313-76f6-4f84-9ec5-93b950119fab_1701664202.9792085.png)\n\n# Complexity\n- Time complexity: \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {number[]} nums\n * @param {number} k\n * @return {number}\n */\nvar countPairs = function(nums, k) {\n    let c=0\n    for(let i=0;i<nums.length;i++){\n        for(let j=i+1;j<nums.length;j++){\n            if(nums[i]===nums[j]&&(i*j)%k===0){\n                c++\n            }\n        }\n    }\n    return c\n};\n```
['JavaScript']