Easy Solution in C++ || Optimal Solution
\n Describe your first thoughts on how to solve this problem. \n\n\n\n# Code\n\nclass Solution {\npublic:\n    int numberOfPairs(vector<int>& nums1, vector<int>
\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n        int count = 0;\n        int i = 0, j = 0;\n        while(i<nums1.size() && j<nums2.size()){\n            if(nums1[i] % (nums2[j++]*k) == 0){\n                count++;\n            }\n           if(j==nums2.size()){\n                j = 0;\n                i++;\n            }\n        }\n        return count;\n    }\n};\n```
['C++']