Only Using Map Simple Solution ✅✅
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$$O(n2)$$ \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        unordered_map<long long,int>mp1,mp2;\n        for(auto it:nums1){\n           long long k=1LL*it*it;\n            mp1[k]++;\n        }\n            for(auto it:nums2){\n                  long long k=1LL*it*it;\n            mp2[k]++;\n        }\n        \n        int cnt=0;\n        for(int i=0;i<nums2.size()-1;i++){\n            long long p=nums2[i];\n            for(int j=i+1;j<nums2.size();j++){\n                  p=p*nums2[j];\n                  if(mp1.find(p)!=mp1.end())  cnt+=mp1[p];\n                  p=nums2[i];\n            }\n\n        }\n        cout<<endl;\n        for(int i=0;i<nums1.size()-1;i++){\n            long long q=nums1[i];\n            for(int j=i+1;j<nums1.size();j++){\n                  q=q*nums1[j];\n           \n                  if(mp2.find(q)!=mp2.end())  cnt+=mp2[q];\n              \n                  q=nums1[i];\n            }\n\n        }\n        return cnt;\n    }\n};\n```
['C++']