Finally Got it
I first wen through each list. We may use greedy since we just need 1 occurence of an item for it to count.\nSo I start with 2 variables.\nThen I went through e
I first wen through each list. We may use greedy since we just need 1 occurence of an item for it to count.\nSo I start with 2 variables.\nThen I went through each list to get rid of the numbers that occur more than once in each individual list. This is a guarenteed thinning.\n(Also I stored the occurences of both lists combined in a dictionary for O(1) access)\nThen I iterated through each list and if the occurence of that item occurs more in both lists, that would be redudant, thus we can remove it.\nThen after all of this is done, the last case scenario would be removing actual items from the set. We must remove at least n/2, so we subtract the items we\'ve already removed from n/2 for both variables, then subtract that from the total number of unique items from both lists. \n\n# Code\n```\nclass Solution:\n    def maximumSetSize(self, nums1: List[int], nums2: List[int]) -> int:\n        from collections import Counter\n        d={}\n        for a in Counter(nums1+nums2).most_common():\n            d[a[0]]=a[1]\n        n=int(len(nums1)/2)\n        de=0\n        un1=Counter(nums1).most_common()\n        for a in un1:\n            if (a[1]-1)+de>=n:\n                d[a[0]]-=(n-de)\n                de=False\n                break\n            d[a[0]]-=(a[1]-1)\n            de+=(a[1]-1)\n          \n            if (a[1]-1)==0:\n                \n                break\n        \n        de1=0\n        un2=Counter(nums2).most_common()\n        for a in un2:\n            if (a[1]-1)+de1>=n:\n                d[a[0]]-=(n-de1)\n                de1=False\n                break\n            d[a[0]]-=(a[1]-1)\n            de1+=(a[1]-1)\n            \n            if (a[1]-1)==0:\n                \n                break\n        #print(de,de1)\n        if type(de)==int:\n\n            for a in un1:\n                if d[a[0]]>1:\n                    d[a[0]]-=1\n                    de+=1\n                if de>=n:\n                    de=False\n                    break\n        \n        if type(de1)==int:\n            for a in un2:\n                if d[a[0]]>1:\n                    d[a[0]]-=1\n                    de1+=1\n                if de1>=n:\n                    de1=False\n                    break\n        \n        diff=0\n        if type(de)==int:\n            diff+=(n-de)\n        \n        if type(de1)==int:\n            diff+=(n-de1)\n        return len(list(d.keys()))-diff\n                \n        \n            \n```
['Python3']