Java simple hashmap solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \ncreated a check functio
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\ncreated a check function which checks the condition given in the question. and this check function is called twice as asked in question.\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 check(nums1,nums2)+ check(nums2,nums1);\n    }\n    \n    public int check(int[] nums1, int[] nums2){\n        int count=0;\n        HashMap<Integer,Integer> store = new HashMap<>();\n        \n        for(int v:nums1){\n            store.put((v*v),store.getOrDefault(v*v,0)+1);\n        }\n        \n        for(int j=0; j<nums2.length-1; j++){\n            for(int k=j+1; k<nums2.length; k++){\n                if(store.get(nums2[j]*nums2[k])!=null){\n                    count+=store.get(nums2[j]*nums2[k]);\n                }\n            }\n        }\n        return count;\n    }\n}\n```
['Java']