[C++] Count by Sets
Intuition\n Describe your first thoughts on how to solve this problem. \n- Put the arrays nums1 and nums2 into sets set1 and set2\n\n# Approach\n Describe your 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Put the arrays `nums1` and `nums2` into sets `set1` and `set2`\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Count with the condition\n\n# Complexity\n- Time complexity: $$O(nums1.length + nums2.length)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(nums1.length + nums2.length)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    // time/space: O(nums1.length + nums2.length)/O(nums1.length + nums2.length)\n    vector<int> findIntersectionValues(vector<int>& nums1, vector<int>& nums2) {\n        unordered_set<int> set1(nums1.begin(), nums1.end());\n        unordered_set<int> set2(nums2.begin(), nums2.end());\n        int count1 = 0, count2 = 0;\n        for (auto& num : nums1) count1 += set2.count(num);\n        for (auto& num : nums2) count2 += set1.count(num);\n        return {count1, count2};\n    }\n};\n```
['Hash Table', 'Counting', 'C++']