🔥Simple approach with easy steps ✅
IntuitionThe primary idea is to leverage the properties of a set, which inherently disallows duplicate elements and offers efficient operations for insertion an
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The primary idea is to leverage the properties of a set, which inherently disallows duplicate elements and offers efficient operations for insertion and lookup. By storing elements of one array in a HashSet, we can quickly check for the presence of elements from the other array, thus determining the common elements between the two arrays.

# Approach
<!-- Describe your approach to solving the problem. -->
1. Initialize HashSets: Create a HashSet to store unique elements from the first array (nums1).

2. Populate the HashSet: Iterate through nums1 and add each element to the HashSet.

3. Find Common Elements: Iterate through the second array (nums2) and for each element, check if it exists in the HashSet created from nums1. If it does, add it to a result set to maintain uniqueness.

4. Convert Result to Array: Finally, convert the result set containing the intersection elements into an array.
# Complexity
- Time complexity: O(n+m)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(min(n,m))
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int[] findIntersectionValues(int[] nums1, int[] nums2) {
        HashSet<Integer> set1 = new HashSet<Integer>();
        HashSet<Integer> set2 = new HashSet<Integer>();

        int count1 = 0 , count2 = 0;

        int[] result = new int[2];
        for(int i : nums1)
        {
            set1.add(i);
        }

        for(int i : nums2){
            set2.add(i);
        }

        for(int i : nums1){
            if(set2.contains(i)) count1++;
        }

        for(int i : nums2)
        {
            if(set1.contains(i)) count2++;
        }

        result[0] = count1;
        result[1] = count2;
        return result;

        
    }
}
```
['Array', 'Hash Table', 'Java']