Set || Super Simple || C++
Code\n\nclass Solution \n{\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) \n    {\n        set<int> st1, st2;\n        int c1=nums1.si
# Code\n```\nclass Solution \n{\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) \n    {\n        set<int> st1, st2;\n        int c1=nums1.size()/2, c2=nums2.size()/2;\n        for(auto it: nums1)\n        {\n            if(c1>0 && st1.find(it)!=st1.end()) c1--;\n            st1.insert(it);\n        }\n        for(auto it: nums2)\n        {\n            if(c2>0 && st2.find(it)!=st2.end()) c2--;\n            st2.insert(it);\n        }\n        set<int> st;\n        for(auto it: st1) st.insert(it);\n        for(auto it: st2) st.insert(it);\n        int ans=st.size();\n        set<int> newst1=st1;\n        if(c1)\n        {\n            for(auto it: st1)\n            {\n                if(st2.find(it)!=st2.end()) \n                {\n                    c1--;\n                    newst1.erase(it);\n                    if(c1==0) break;\n                }\n            }\n        }\n        if(c2)\n        {\n            for(auto it: st2)\n            {\n                if(newst1.find(it)!=newst1.end()) \n                {\n                    c2--;\n                    if(c2==0) break;\n                }\n            }\n        }\n        if(c1) ans-=c1;\n        if(c2) ans-=c2;\n        return ans;\n    }\n};\n\n```
['C++']