Python (Simple Hashmap)
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```\nclass Solution:\n    def numTriplets(self, nums1, nums2):\n        def dfs(A,B):\n            n, dict1, total = len(A), defaultdict(int), 0\n\n            for i in B:\n                dict1[i*i] += 1 \n\n            for i in range(len(A)):\n                for j in range(i+1,len(A)):\n                    total += dict1[A[i]*A[j]]\n\n            return total \n\n        return dfs(nums1,nums2) + dfs(nums2,nums1)   \n```
['Python3']