Easy Java Solution || HashSet
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimport java.util.*;\nimport java.io.*;\nclass Solution {\n    public int maximumSetSize(int[] arr1, int[] arr2) {\n        int n = arr1.length;\n        HashSet<Integer> set1 = new HashSet<>();\n        for(int i = 0; i < n; i++) set1.add(arr1[i]);\n        HashSet<Integer> set2 = new HashSet<>();\n        for(int i = 0; i < n; i++) set2.add(arr2[i]);\n        HashSet<Integer> set3 = new HashSet<>();\n        Iterator<Integer> it = set1.iterator();\n        while(it.hasNext()){\n            int x = it.next();\n            if(set2.contains(x)) set3.add(x);\n        }\n        int ans1 = set1.size() - set3.size(), ans2 = set2.size() - set3.size();\n        int dis1 = Math.min(ans1, n / 2), dis2 = Math.min(ans2, n / 2);\n        int req = n - dis1 - dis2;\n        return dis1 + dis2 + Math.min(req, set3.size());\n    }\n}\n```
['Hash Table', 'Greedy', 'Java']