Brute Force
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nDONT LOOK AT THE SIZE ITS UNDERSTANTABLE\n\n# Complexity\n- Time complexi
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nDONT LOOK AT THE SIZE ITS UNDERSTANTABLE\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        map<int,int>mp1;\n        map<int,int>mp2;\n        int k1=nums1.size()/2;\n        int k2=nums2.size()/2;\n        for(auto x:nums1){\n            mp1[x]++;\n        }\n        for(auto x:nums2){\n            mp2[x]++;\n        }\n        for(auto &x:mp1){\n            if(k1<=0) break;\n            while(x.second>1 and k1>0){\n                x.second--;\n                k1--;\n            }\n        }\n        for(auto &x:mp2){\n            if(k2<=0) break;\n            while(x.second>1 and k2>0){\n                x.second--;\n                k2--;\n            }\n        }\n        if(k1==0 and k2==0){\n            set<int>st;\n            for(auto x:mp1){\n                st.insert(x.first);\n            }\n            for(auto x:mp2){\n                st.insert(x.first);\n            }\n            return st.size();\n        }\n        if(k1>0 and k2==0){\n            for(auto &x:mp1){\n                if(k1<=0) break;\n                if(mp2.find(x.first)!=mp2.end()){\n                    mp1[x.first]--;\n                    k1--;\n                }\n            }\n            \n            set<int>st;\n            for(auto x:mp1){\n                st.insert(x.first);\n            }\n            for(auto x:mp2){\n                st.insert(x.first);\n            }\n            return st.size()-k1;\n        }\n        if(k1==0 and k2>0){\n            for(auto &x:mp2){\n                if(k2<=0) break;\n                if(mp1.find(x.first)!=mp1.end()){\n                    mp2[x.first]--;\n                    k2--;\n                }\n            }\n            \n            set<int>st;\n            for(auto x:mp1){\n                st.insert(x.first);\n            }\n            for(auto x:mp2){\n                st.insert(x.first);\n            }\n            return st.size()-k2;\n        }\n        if(k1>0 and k2>0){\n            for(auto &x:mp1){\n                if(k1<=0) break;\n                if(mp2.find(x.first)!=mp2.end()){\n                    mp1[x.first]--;\n                    k1--;\n                }\n            }\n            for(auto &x:mp2){\n                if(k2<=0) break;\n                if(mp1.find(x.first)!=mp1.end()){\n                    mp2[x.first]--;\n                    k2--;\n                }\n            }\n            set<int>st;\n            for(auto x:mp1){\n                st.insert(x.first);\n            }\n            for(auto x:mp2){\n                st.insert(x.first);\n            }\n            if((st.size()-k2-k1)>nums1.size()){\n                return nums1.size();\n            }\n            return st.size()-k2-k1;\n        }\n        return -1;\n    }\n};\n```
['Ordered Map', 'C++']