93%/91% Python3, Hash table
\nfrom collections import Counter\n\nclass Solution:\n    def numTriplets(self, nums1: List[int], nums2: List[int]) -> int:\n        def helper(A, B):\n        
```\nfrom collections import Counter\n\nclass Solution:\n    def numTriplets(self, nums1: List[int], nums2: List[int]) -> int:\n        def helper(A, B):\n            ans = 0\n            C = Counter([a*a for a in A])\n            D = Counter()\n            for b in B:\n                for k, v in D.items():\n                    if k*b in C:\n                        ans += v * C[k*b]\n                D[b] += 1\n            return ans\n        \n        return helper(nums1, nums2) + helper(nums2, nums1)\n```
[]