Easy Two Maps Approach
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 n=nums1.size();\n       int m=nums2.size(); \n       unordered_map<long long,long long>mp1;\n       unordered_map<long long,long long>mp2;\n       for(int i=0;i<n-1;i++){\n         for(int j=i+1;j<n;j++){\n            long long mul=(long)((long)nums1[i]*(long)nums1[j]);\n            mp1[mul]++;\n         }\n       }\n       for(int i=0;i<m-1;i++){\n         for(int j=i+1;j<m;j++){\n            mp2[(long)((long)nums2[i]*(long)nums2[j])]++;\n         }\n       }\n       long long cnt=0;\n       for(int i=0;i<m;i++){\n        if(mp1.find((long)nums2[i]*(long)nums2[i])!=mp1.end()){\n            cnt+=mp1[(long)nums2[i]*(long)nums2[i]];\n        }\n       }\n         for(int i=0;i<n;i++){\n        if(mp2.find((long)nums1[i]*(long)nums1[i])!=mp2.end()){\n            cnt+=mp2[((long)nums1[i]*(long)nums1[i])];\n        }\n       }\n       return (int)cnt;\n\n\n    }\n};\n```
['C++']