Java Bruteforce O(N^2)
```\nclass Solution {\n    public int numTriplets(int[] nums1, int[] nums2) {\n        return getCount(nums1, getMap(nums2)) + getCount(nums2, getMap(nums1));\n
```\nclass Solution {\n    public int numTriplets(int[] nums1, int[] nums2) {\n        return getCount(nums1, getMap(nums2)) + getCount(nums2, getMap(nums1));\n    }\n    \n    Map<Long, Integer> getMap(int[] nums){\n        Map<Long, Integer> map = new HashMap<>();\n        for(long num: nums)\n            map.put(num * num, map.getOrDefault(num * num,0)+1);\n        return map;\n    }\n    \n    int getCount(int[] nums, Map<Long, Integer> map){\n        int count=0;\n        for(int i=0;i<nums.length;i++){\n            for(int j=i+1;j<nums.length;j++){\n                long prod = (long)nums[i]*(long)nums[j];\n                if(map.containsKey(prod))\n                    count += map.get(prod);\n            }\n        }\n        return count;\n    }\n}
[]