Java Easy 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:\nO(n2)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    public int numTriplets(int[] nums1, int[] nums2) {\n        if(nums1.length<=1 || nums2.length<=1 ) return 0;\n        return cal(nums1,nums2)+cal(nums2,nums1);\n        \n    }public int  cal(int[] nums1,int[] nums2){\n        int count=0;\n        HashMap<Integer,Integer> num1=new HashMap<>();\n       \n        for(int i:nums1){\n            num1.put((i*i), num1.getOrDefault(i*i, 0)+1);\n        }\n        for(int i=0;i<nums2.length-1;i++){\n            for(int j=i+1;j<nums2.length;j++){\n            if(num1.get(nums2[i]*nums2[j])!=null) count+=(num1.get(nums2[i]*nums2[j]));\n            }\n        }\n       return count; \n    }\n}\n```
['Java']