Set || Beat 100% || C++
\nclass Solution {\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) \n    {\n        unordered_set<int> s1,s2;\n        for(auto n:nums1
```\nclass Solution {\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) \n    {\n        unordered_set<int> s1,s2;\n        for(auto n:nums1)\n        {\n            s1.insert(n);\n        }\n        for(auto n:nums2)\n        {\n            s2.insert(n);\n        }\n        \n        // count the overlap\n        int overlap = 0;\n        for(auto n:s1)\n        {\n            if(s2.find(n) != s2.end())\n            {\n                overlap++;\n            }\n        }\n        \n        return min(\n            min(s1.size(),nums1.size()/2)\n               + min(s2.size(),nums2.size()/2),\n            s1.size() + s2.size() - overlap\n        );\n    }\n};\n```
[]