C++ Solution || Easy Approach
\nclass Solution {\npublic:\n    #define ll long long int\n    \n    int count(vector<int> & A,vector<int>& B)\n    {\n        map<ll,int> m;\n        int c=0;\
```\nclass Solution {\npublic:\n    #define ll long long int\n    \n    int count(vector<int> & A,vector<int>& B)\n    {\n        map<ll,int> m;\n        int c=0;\n        for(auto a :A) m[(ll)a*a]++;\n\n        for(int i=0;i<B.size()-1;i++)\n        {\n            for(int j{i+1};j<B.size();j++)\n            {\n                if(m.count((ll)B[i]*B[j]))\n                    c+=m[(ll)B[i]*B[j]];\n            }\n        }\n        return c;\n    }\n    int numTriplets(vector<int>& nums1, vector<int>& nums2) {\n        \n        return count(nums1,nums2) + count(nums2,nums1);\n    }\n};\n```
['C']