Python Simple Solution (sets) (accepted)
Code\n\nimport collections\nclass Solution:\n    def maximumSetSize(self, nums1: List[int], nums2: List[int]) -> int:\n        max_len = len(nums1) // 2\n      
# Code\n```\nimport collections\nclass Solution:\n    def maximumSetSize(self, nums1: List[int], nums2: List[int]) -> int:\n        max_len = len(nums1) // 2\n        nums1_set = set(nums1)\n        nums2_set = set(nums2)\n        \n        if len(nums1_set) <= max_len and len(nums2_set) <= max_len:\n            return len(nums1_set.union(nums2_set))\n        \n        num1_added = set()\n\n        for num in nums1_set:\n            if num not in nums2_set and len(num1_added) < max_len:\n                num1_added.add(num)\n        \n        num2_added = set()\n        \n        for num in nums2_set:\n            if num not in nums1_set and len(num2_added) < max_len:\n                num2_added.add(num)\n    \n        for i in nums1_set:\n            if len(num1_added) < max_len and i not in num1_added:\n                num1_added.add(i)\n        \n        for i in nums2_set:\n            if len(num2_added) < max_len and i not in num1_added and i not in num2_added:\n                num2_added.add(i)\n        \n        return len(num1_added.union(num2_added))\n        \n        \n        \n        \n        \n```
['Python3']