C++ | 2 Solution | Naive and Using Hash-Map
1. Simple Naive Solution\n- Time Complexity: O(N^2)\n- Space Complexity: O(1)\n\n\nclass Solution {\npublic:\n    vector<int> findIntersectionValues(vector<int>
# 1. Simple Naive Solution\n**- Time Complexity: O(N^2)**\n**- Space Complexity: O(1)**\n```\n\nclass Solution {\npublic:\n    vector<int> findIntersectionValues(vector<int>& nums1, vector<int>& nums2) {\n        int a=0, b=0;\n        for(int i=0; i<nums1.size(); i++){\n            for(int j=0; j<nums2.size(); j++){\n                if(nums1[i]==nums2[j]){\n                    a++,break;\n                }\n            }\n        }\n        for(int i=0; i<nums2.size(); i++){\n            for(int j=0; j<nums1.size(); j++){\n                if(nums2[i]==nums1[j]){\n                    b++, break;\n                }\n            }\n        }\n        return {a,b};\n    }\n};\n\n``` \n\n# 2. Using HashMap\n**- Time Complexity: O(N)**\n**- Space Complexity: O(N)**\n\n```\nclass Solution {\npublic:\n    vector<int> findIntersectionValues(vector<int>& nums1, vector<int>& nums2) {\n        int a=0, b=0; \n        map<int,int>mp1, mp2;\n        for(int it: nums1)mp1[it]++;\n        for(int it: nums2)mp2[it]++;\n        for(auto it: nums1){\n            if(mp2.find(it)!= mp2.end())a++;\n        }\n        for(auto it: nums2){\n            if(mp1.find(it)!= mp1.end())b++;\n        } \n        return {a,b};\n    }\n};\n```
['C++']