C++ || Precomputed divisors using hash map
ApproachThis optimized approach will be faster, especially for larger arrays with duplicate values in nums2.

Precomputation:
Precompute all possible divisors n
# Approach
This optimized approach will be faster, especially for larger arrays with duplicate values in `nums2`.

1. **Precomputation:**
Precompute all possible divisors `nums2[j] * k` and their frequencies.

2. **Efficient Divisibility Check:**
For each element in `nums1`, iterate through the precomputed divisors, checking divisibility and summing up counts.

# Complexity
- Time complexity:
    `O(m + n x d)` where `d` is the unique `nums2[j] * k` values.

    This is generally better than `O(mxn)`, especially if there are duplicate values in nums2.

- Space complexity:
`O(d)`, for storing the hashmap of divisors.

# Code
```cpp []
class Solution {
public:
    int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k)
    {
        unordered_map<int,int> divisor;
        for( const auto& n : nums2)
        {
            divisor[n*k]++;
        }

        int goodPair = 0;
        for( int n : nums1)
        {
            for( const auto& [d ,c] : divisor )
            {
                if( n % d == 0)
                    goodPair += c;
            } 
        }
        return goodPair;
    }
};
```
['C++']