Why 91/92 TCs passed? Please suggest/help.
\nclass Solution {\n    public int numTriplets(int[] nums1, int[] nums2) {\n        Arrays.sort(nums1);\n        Arrays.sort(nums2);\n        \n        int ans 
```\nclass Solution {\n    public int numTriplets(int[] nums1, int[] nums2) {\n        Arrays.sort(nums1);\n        Arrays.sort(nums2);\n        \n        int ans = 0;\n        int n1 = nums1.length, n2 = nums2.length;\n        Map<Long, Integer> S1 = new HashMap<>();\n        Map<Long, Integer> S2 = new HashMap<>();\n        \n        for (int i = 0; i < n1; i++) {\n            long s1 = (nums1[i] * nums1[i]);\n            S1.put(s1, S1.getOrDefault(s1, 0) + 1);\n        }\n        // System.out.println("S1 = " + S1);\n        \n        for (int i = 0; i < n2; i++) {\n            long s2 = ((long)nums2[i] * (long)nums2[i]);\n            S2.put(s2, S2.getOrDefault(s2, 0) + 1);\n        }\n        // System.out.println("S2 = " + S2);\n        \n        for (int j = 0; j < n2; j++) {\n            for (int k = j + 1; k < n2; k++) {\n                long mul = ((long)nums2[j] * (long)nums2[k]);\n                // System.out.println(nums2[j] + " " + nums2[k] + " = " + mul);\n                if (S1.containsKey(mul)) {\n                    ans += S1.get(mul);\n                }\n            }\n        }\n        \n        for (int j = 0; j < n1; j++) {\n            for (int k = j + 1; k < n1; k++) {\n                long mul = ((long)nums1[j] * (long)nums1[k]);\n                // System.out.println(nums1[j] + " * " + nums1[k] + " = " + mul);\n                if (S2.containsKey(mul)) {\n                    ans += S2.get(mul);\n                }\n            }\n        }\n         \n        return ans;\n    }\n}\n```\n\n1 blunder as not converted square elements into long. As mentioned below also corrected answer.\n\n**long s1 = ((long)nums1[i] * (long)nums1[i]);**
['Sorting']