Simple Brute-force & optimal solution
Here is the better solution then bruteforce approach : https://leetcode.com/problems/find-the-number-of-good-pairs-ii/solutions/5208919/check-all-factors-of-num
Here is the better solution then bruteforce approach : https://leetcode.com/problems/find-the-number-of-good-pairs-ii/solutions/5208919/check-all-factors-of-nums1/\n\n# Code\n```\nint numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n    int ans = 0;\n    for(int i = 0; i < nums1.size(); ++i){\n        for(int j = 0; j < nums2.size(); ++j){\n            int div = nums2[j]*k;\n            if(nums1[i]%div == 0) ans++;\n        }\n    }\n    return ans;\n}\n```\n\n\n\n---\n\n<b>Here is an article of my last interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted\n\n---
['C++']