Very intuitive solution using dictionary
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def numTriplets(self, nums1: List[int], nums2: List[int]) -> int:\n        d1,d2=defaultdict(int),defaultdict(int)\n        for num in nums1:\n            d1[num*num]+=1\n        for num in nums2:\n            d2[num*num]+=1\n        res=0\n        for i in range(len(nums1)):\n            for j in range(i+1,len(nums1)):\n                tmp=nums1[i]*nums1[j]\n                if tmp in d2: res+=d2[tmp]\n \n        for i in range(len(nums2)):\n            for j in range(i+1,len(nums2)):\n                tmp=nums2[i]*nums2[j]\n                if tmp in d1: res+=d1[tmp]\n        return res\n```
['Python3']