C ++ solution . TC -- > O(n)
Intuition\n Describe your first thoughts on how to solve this problem. \nPick unique elements from both arrays and then go for common elements if needed .\n\n# 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nPick unique elements from both arrays and then go for common elements if needed .\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\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        int n = nums1.size();\n        unordered_map<int,int>mp;\n        unordered_set<int>st(nums1.begin(), nums1.end());\n        unordered_set<int>st2(nums2.begin(), nums2.end());\n        for(auto it : st){\n            mp[it]++;\n        }\n        for(auto it : st2){\n            mp[it]++;\n        }\n        int nn = n / 2, mm = nn;\n        unordered_set<int>ans;\n        int common = 0;\n        for(auto it : mp){\n            if(it.second == 2) common ++;\n        }\n        for(auto it : st){\n            if(mp[it] == 1 && nn > 0){\n                ans.insert(it);\n                nn --;\n            }\n        }\n        for(auto it : st2){\n            if(mp[it] == 1 && mm > 0){\n                ans.insert(it);\n                mm --;\n            }\n        }\n        return ans.size() + min(common, mm + nn);\n        \n    }\n};\n```
['C++']