Brute force approach | C++
\nclass Solution {\npublic:\n    int numTriplets(vector<int>& nums1, vector<int>& nums2) {\n        \n        unordered_map<long, int> m1, m2;\n        for(int 
```\nclass Solution {\npublic:\n    int numTriplets(vector<int>& nums1, vector<int>& nums2) {\n        \n        unordered_map<long, int> m1, m2;\n        for(int i : nums1) m1[(long long)i*i]++;\n        for(int i : nums2) m2[(long long)i*i]++;\n        \n        int ans = 0;\n        \n        for(int i=0; i<nums2.size()-1; i++){\n            for(int j=i+1; j<nums2.size(); j++){\n                if(m1[(long long)nums2[i] * nums2[j]]){\n                    ans += m1[(long long)nums2[i] * nums2[j]];\n                }\n            }\n        }\n        for(int i=0; i<nums1.size()-1; i++){\n            for(int j=i+1; j<nums1.size(); j++){\n                if(m2[(long long)nums1[i] * nums1[j]]){\n                    ans += m2[(long long)nums1[i] * nums1[j]];\n                }\n            }\n        }\n        return ans; \n    }\n};\n```
['C']