SET -Union-Intersection
Intuition\n ans will not exceed n/2 (unique elements from nums1) + n/2(unique elements from nums2) = n.  \n If there are more than n/2 unique elements from nums
# Intuition\n* ans will not exceed n/2 (unique elements from nums1) + n/2(unique elements from nums2) = `n`.  \n* If there are more than n/2 unique elements from nums1 , then we can easily delete `n/2` elements and make the uniqueness factor from nums1 to `n/2`. \n* Similarly for `nums2`. \n\n* `ans = min(n , min(n/2 , s1.size()-common) + min(n/2 , s2.size() - common) + common)`. \n\n# Code\n```\nclass Solution {\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) {\n         \n        int n = nums1.size();\n        set<int>Union;  \n        set<int> s1(nums1.begin() , nums1.end()); \n        set<int> s2(nums2.begin() , nums2.end());  \n        for(int num : nums1)Union.insert(num); \n        for(int num : nums2)Union.insert(num);\n        int common = s1.size() + s2.size() - Union.size(); \n        int ans = 0; \n        ans+= min(n/2 , (int)s1.size() - common); \n        ans+= min(n/2 , (int)s2.size() - common); \n        ans+=common; \n        return min(n , ans); \n    }\n};\n```
['Hash Table', 'Math', 'Union Find', 'Ordered Set', 'C++']