easy solution | beats 100%
Intuition\nTo determine the number of good pairs (i, j) where nums1[i] is divisible by nums2[j]*k, we can use a straightforward nested loop approach. For each e
# Intuition\nTo determine the number of good pairs `(i, j)` where `nums1[i]` is divisible by `nums2[j]*k`, we can use a straightforward nested loop approach. For each element in `nums2`, calculate `nums2[j]*k` and then check all elements in `nums1` to see if they are divisible by this value.\n\n# Approach\n1. **Initialize Count**: Start with a counter set to 0 to keep track of the number of good pairs.\n2. **Nested Loop**: Use a nested loop where the outer loop iterates over each element in `nums2` and the inner loop iterates over each element in `nums1`.\n3. **Calculate and Check Divisibility**: For each combination of elements from `nums1` and `nums2`, compute the value `nums2[j]*k`. Check if `nums1[i]` is divisible by this computed value. If true, increment the counter.\n4. **Return Result**: After both loops complete, return the counter value.\n\n# Complexity\n- Time complexity: \n  - The nested loop results in $$O(n*m)$$ operations, where n is the length of `nums1` and m is the length of `nums2`.\n\n- Space complexity: \n  - $$O(1)$$, as we are using only a few extra variables that do not depend on the input size.\n\n# Code\n```cpp\nclass Solution {\npublic:\n    int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n        int ans = 0;\n        for (int j = 0; j < nums2.size(); ++j) {\n            long long num = nums2[j] * k;\n            for (int i = 0; i < nums1.size(); ++i) {\n                if (nums1[i] % num == 0) {\n                    ++ans;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']