Java solution using HashSet
Code\n\nclass Solution {\n    public int maximumSetSize(int[] nums1, int[] nums2) {\n        Set<Integer> s1 = new HashSet(); \n        Set<Integer> s2 = new Ha
# Code\n```\nclass Solution {\n    public int maximumSetSize(int[] nums1, int[] nums2) {\n        Set<Integer> s1 = new HashSet(); \n        Set<Integer> s2 = new HashSet();\n        Set<Integer> s3 = new HashSet(); \n        \n        for (int num: nums1){\n            s1.add(num);\n            s3.add(num);\n        } \n        for (int num: nums2) {\n            s2.add(num);\n            s3.add(num);\n        } \n          \n        return Math.min(Math.min(s1.size(), nums1.length/2) + \n                        Math.min(s2.size(), nums2.length/2), s3.size());                            \n    }\n}\n```
['Java']