Easy Solution which Beats 99.24%
IntuitionThe problem requires counting pairs of indices (i, j) where the elements at those indices are equal and their product is divisible by a given integer k
# Intuition
The problem requires counting pairs of indices (i, j) where the elements at those indices are equal and their product is divisible by a given integer k. The condition is that both nums[i] == nums[j] and (i * j) % k == 0.

# Approach
We can approach the problem using a brute force solution by iterating over all pairs of indices (i, j), where i < j. For each pair:

1) We check if the elements at these indices are equal (nums[i] == nums[j]).
2) If they are equal, we check if the product of the indices (i * j) is divisible by k ((i * j) % k == 0).
3) If both conditions are met, we increment the count.
Complexity


# Complexity
- Time complexity:
The approach uses two nested loops over the array of size n, which results in a time complexity of O(n^2).

- Space complexity:
The space complexity is O(1), as we are only using a few variables to track the count and do not need any additional space that scales with the input size.

# Code
```java []
class Solution {
    public int countPairs(int[] nums, int k) {
        int count = 0;
        
        for(int i=0; i<nums.length; i++) {
            for(int j=i+1; j<nums.length; j++) {
                if(nums[j]==nums[i] && (i*j) % k == 0) {
                    count++;
                }
            }        
        }
        return count;
    }
}
```
['Array', 'Java']