Easy To understand java solution | Beats 100%
\n\n# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\nO(n)\n\n# Code\n\nclass Solution {\n    public int[] findIntersectionValues(int[] nums1, int[
\n\n# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    public int[] findIntersectionValues(int[] nums1, int[] nums2) {\n        HashSet<Integer> set1 = new HashSet<>();\n        HashSet<Integer> set2 = new HashSet<>();\n        int[] ans= new int[2];\n        int count1=0,count2=0;\n        for(int c:nums1) set1.add(c);\n        for(int c:nums2) {\n            set2.add(c);\n            if(set1.contains(c)) count2++;\n        }\n        for(int c:nums1){\n            if(set2.contains(c)) count1++;\n        }\n        ans[0]=count1;\n        ans[1]=count2;\n        return ans;\n        \n\n    }\n}\n```
['Java']