Easy Set Solution
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```cpp []\nclass Solution {\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) {\n        int n = nums1.size();\n        set<int> st1, st2, st;\n        for(auto it: nums1) st1.insert(it);\n        for(auto it: nums2) st2.insert(it);\n\n        for(auto it: nums1){\n            if(st2.count(it)) st.insert(it);\n        }\n\n        while(st1.size() > n/2 && !st.empty()){\n            auto it = *st.begin();\n            st1.erase(it);\n            st.erase(st.begin());\n        }\n        while(st2.size() > n/2 && !st.empty()){\n            auto it = *st.begin();\n            st2.erase(it);\n            st.erase(st.begin());\n        }\n\n        if(!st.empty()){\n            return st1.size() + st2.size() - st.size();\n        }\n        return min(n/2, (int)st1.size()) + min(n/2, (int)st2.size());\n    }\n};\n```
['C++']