Easy Java
Code\n\nclass Solution {\n    public int maximumSetSize(int[] nums1, int[] nums2) {                  \n        Map<Integer,Integer> mp1 = new HashMap<>();   \n 
# Code\n```\nclass Solution {\n    public int maximumSetSize(int[] nums1, int[] nums2) {                  \n        Map<Integer,Integer> mp1 = new HashMap<>();   \n        Map<Integer,Integer> mp2 = new HashMap<>();\n        for(int i=0; i<nums1.length; i++){\n            if(!mp1.containsKey(nums1[i])){\n                mp1.put(nums1[i],1);\n            }else{\n                mp1.put(nums1[i],mp1.get(nums1[i])+1);\n            }            \n            if(!mp2.containsKey(nums2[i])){\n                mp2.put(nums2[i],1);\n            }else{\n                mp2.put(nums2[i],mp2.get(nums2[i])+1);\n            }\n        }   \n        Set<Integer> res = new HashSet<>();\n        int cnt = 0;\n        for (Map.Entry<Integer, Integer> entry : mp1.entrySet()) {\n            int currElem = entry.getKey();\n            if(!mp2.containsKey(currElem)){\n                res.add(currElem);\n                cnt++;\n            }\n            if(cnt==nums1.length/2)\n                break;\n            \n        }\n        if(cnt<nums1.length/2){\n            for (Map.Entry<Integer, Integer> entry : mp1.entrySet()) {\n                if(!res.contains(entry.getKey())){\n                    res.add(entry.getKey());\n                    cnt++;\n                }\n                if(cnt==nums1.length/2)\n                    break;\n            }    \n        }\n        cnt = 0;\n        for (Map.Entry<Integer, Integer> entry : mp2.entrySet()) {\n            if(!res.contains(entry.getKey())){\n                    res.add(entry.getKey());\n                    cnt++;\n                }\n                if(cnt==nums1.length/2)\n                    break;\n        }\n        return res.size();\n    }\n}\n```
['Java']