2176: Count-Equal-and-Divisible-Pairs-in-an-Array
Easy

Another brute-force solution. Not much else to say other than iterate through all pairs and check if satisfies the conditions present in the question description.

Code:

class Solution {
public:
    int countPairs(vector<int>& nums, int k) {
        int ans = 0;
        for (int i = 0; i < nums.size(); ++i) {
            for (int j = i+1; j < nums.size(); ++j) {
                if (nums[i] == nums[j] && (i*j)%k == 0) {
                    ++ans;
                }
            }
        }
        return ans;
    }
};

Complexity:

Time Taken: