Time complexity 0(n) solution
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem here is to reduce the time complexity from o(n2) to o(n) so taking this as 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem here is to reduce the time complexity from o(n2) to o(n) so taking this as the primary intution try to code with a single for loop\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nhere we have taken one pointer or we can say counter with respect to 2nd array and the basic operation to find the modulus is same .But the 2nd nums2 array is controlled by an if statement and any time the nums1 reaches the max index we set it to zero provided c1 the counter for the 2nd array is not out of length.we innitialize i=-1 because as the control reaches the top of the loop it starts with ++i.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n0(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\nclass Solution {\n    public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n        int c1=0;int c2=0;\n       for(int i=0;i<nums1.length;i++){\n        if(nums1[i] % (nums2[c1]*k)==0){\n            c2++;\n        }\n        if(i==nums1.length-1 && c1<nums2.length-1){\n            i=-1;\n            c1++;\n        }\n       }\n       return c2;\n    }\n}\n```
['Java']