Best Java Solution || Beats 100% || HashSet
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] findIntersectionValues(int[] nums1, int[] nums2) {\n        HashSet<Integer> hp1 = new HashSet<>();   \n        HashSet<Integer> hp2 = new HashSet<>();   \n\n        int n = nums1.length;\n        int m = nums2.length;\n\n        for(int i=0; i<n; i++){\n            hp1.add(nums1[i]);\n        }\n\n        \n        for(int i=0; i<m; i++){\n            hp2.add(nums2[i]);\n        }\n\n        int ans[] = new int[]{0,0};\n        int count1=0;\n        int count2=0;\n\n        for(int i=n-1; i>=0; i--){\n            if(hp2.contains(nums1[i])){\n                count1++;\n            }\n        }\n\n        \n        for(int i=m-1; i>=0; i--){\n            if(hp1.contains(nums2[i])){\n                count2++;\n            }\n        }\n        ans[0] = count1;\n        ans[1] = count2;\n        return ans;\n    }\n}\n```
['Java']