🔥Greedy💯 || ✅Clean Code
Complexity\n\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n\n# Code\n## Please Upvote if it helps\uD83E\uDD17\n\nclass Solution {\npublic:\n    int 
# Complexity\n```\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n```\n\n# Code\n## Please Upvote if it helps\uD83E\uDD17\n```\nclass Solution {\npublic:\n    int maximumSetSize(vector<int>& nums1, vector<int>& nums2) {\n        int n = nums1.size(), ans = 0, count = 0;\n        unordered_set<int> st1(nums1.begin(), nums1.end());\n        unordered_set<int> st2(nums2.begin(), nums2.end());\n        for(auto x : st1){\n            if(!st2.contains(x)){\n                count++;\n                ans++;\n            }\n            if(count == n / 2)\n                break;\n        }\n        count = 0;\n        for(auto x : st2){\n            if(!st1.contains(x)){\n                count++;\n                ans++;\n            }\n            if(count == n / 2)\n                break;\n        }\n        count = 0;\n        if(ans != n){\n            for(auto x : st1){\n                if(st2.contains(x))\n                    count++;\n            }\n            ans += min(n - ans, count);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Greedy', 'Ordered Set', 'C++']