Using Hash Map || Easy || C++
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 {\npublic:\n    int numTriplets(vector<int>& nums1, vector<int>& nums2) {\n        int n1=nums1.size();\n        int n2=nums2.size();\n        unordered_map<long long,int> mp1;\n        unordered_map<long long,int> mp2;\n        for(int i=0;i<n1;i++){\n            for(int j=i+1;j<n1;j++){\n                mp1[(long long)nums1[i]*nums1[j]]++;\n            }\n        }\n        for(int i=0;i<n2;i++){\n            for(int j=i+1;j<n2;j++){\n                mp2[(long long)nums2[i]*nums2[j]]++;\n            }\n        }\n        int count=0;\n        for(int i=0;i<n1;i++){\n            int x=mp2[(long long)nums1[i]*nums1[i]];\n            if(x>0) count+=x;\n        }\n        for(int i=0;i<n2;i++){\n            int x=mp1[(long long)nums2[i]*nums2[i]];\n            if(x>0) count+=x;\n        }\n        return count;\n    }\n};\n```
['C++']