JS || Solution by Bharadwaj
Code\n\nvar numTriplets = function (nums1, nums2) {\n    return Triplets(nums1, nums2) + Triplets(nums2, nums1);\n\n    function Triplets(nums1, nums2) {\n     
# Code\n```\nvar numTriplets = function (nums1, nums2) {\n    return Triplets(nums1, nums2) + Triplets(nums2, nums1);\n\n    function Triplets(nums1, nums2) {\n        let res = 0;\n        for (let i = 0; i < nums1.length; i++) {\n            let target = nums1[i] * nums1[i], map = new Map();\n            for (let j = 0; j < nums2.length; j++) {\n                res += map.get(target / nums2[j]) || 0;\n                map.set(nums2[j], (map.get(nums2[j]) || 0) + 1);\n            }\n        }\n        return res;\n    }\n};\n```
['JavaScript']