Simple Python3 with Speed Improvement
Intuition\n Describe your first thoughts on how to solve this problem. \nIf the element X in nums1 is not devisable by k then we can avoid extra calculation for
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIf the element X in nums1 is not devisable by k then we can avoid extra calculation for each member of nums2 for that element X.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nCheck divisibility by k and continue before getting into second loop.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(m*n) with m and n being length of nums1 and nums2 respectively, For worst case scenario that all elements are devisable by k and elements of nums2.\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution:\n    def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n        ans = 0\n        for m in nums1:\n            if m%k!=0:\n                continue\n            for n in nums2:\n                if m % (n*k)==0:\n                    ans+=1\n        return ans\n```
['Python3']