Beginners Friendly | Easy explanation | Python
\n# Approach\n Describe your approach to solving the problem. \n1. It creates unordered sets set1 and set2 from nums1 and nums2 respectively. These sets contain
\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. It creates unordered sets `set1` and `set2` from `nums1` and `nums2` respectively. These sets contain unique elements from the vectors, allowing faster lookup.\n\n2. Two counts, `count1` and `count2`, are initialized to 0.\n\n3. It iterates through `nums1` and checks if each element exists in `set2`. If found, it increments `count1`.\n\n4. Similarly, it iterates through `nums2` and checks if each element exists in `set1`. If found, it increments `count2`.\n\n5. Finally, it returns a vector containing the counts of intersection for both vectors.\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(m+n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def findIntersectionValues(self, nums1: List[int], nums2: List[int]) -> List[int]:\n        set1 = set(nums1)\n        set2 = set(nums2)\n\n        count1, count2 = 0,0\n        for num in nums1:\n            if num in set2:\n                count1 +=1\n        for num in nums2:\n            if num in set1:\n                count2 +=1\n        return [count1,count2]\n```
['Python3']