Beginners friendly
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 {\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2)\n    {\n        int y = nums1.size(),x=nums2.size();\n        sort(nums1.begin(),nums1.end());\n        nums1.erase(unique(nums1.begin(),nums1.end()),nums1.end());\n         sort(nums2.begin(),nums2.end());\n        nums2.erase(unique(nums2.begin(),nums2.end()),nums2.end());\n       int n1 = nums1.size(), n2 = nums2.size();\n       int rem1 = y-n1;int rem2 = x-n2,cnt=0;\n       unordered_map<int,int>mp;\n       for(int i=0;i<n1;i++)\n        mp[nums1[i]]++;\n        for(int i=0;i<n2;i++)\n        {\n            if(mp.find(nums2[i]) != mp.end())\n             cnt++;\n        }\n       if(rem2>y/2)\n       rem2=y/2;\n       if(rem1>y/2)\n       rem1 = y/2;\n          if(rem1+rem2+cnt>=y)\n          return  n1+n2-cnt;\n         \n          return n1+n2-cnt-(y-(rem1+rem2+cnt));\n      \n\n    }\n};\n```
['Greedy', 'Sorting', 'C++']