Hash Map || JavaScript || O(n*m)
Code


# Code
```javascript []
/**
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @param {number} k
 * @return {number}
 */
var numberOfPairs = function(nums1, nums2, k) {
    const freq = new Map();
    for (const num of nums2) {
        const key = num * k;
        freq.set(key, (freq.get(key) || 0) + 1);
    }

    let count = 0;
    for (const num of nums1) {
        for (const [key, cnt] of freq) {
            if (num % key === 0) {
                count += cnt;
            }
        }
    }
    return count;
};

```
['JavaScript']