Easy Java Solution || Simple Freq Check || Beats 100% ✅✅
Complexity\n- Time complexity:O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(n)\n Add your space complexity here, e.g. O(n) \n\n# Code
# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maximumSetSize(int[] nums1, int[] nums2) {\n        HashSet<Integer>st=new HashSet<>();\n        int n1=nums1.length;\n        int n2=nums2.length;\n        for(int i=0;i<nums1.length;i++){\n            st.add(nums1[i]);\n        }\n        int size1=st.size();\n        st.clear();\n\n        for(int i=0;i<nums2.length;i++){\n            st.add(nums2[i]);\n        }\n        int size2=st.size();\n        st.clear();\n\n        for(int i=0;i<nums1.length;i++){\n            st.add(nums1[i]);\n        }\n        for(int i=0;i<nums2.length;i++){\n            st.add(nums2[i]);\n        }\n        int size3=st.size();\n\n\n        return Math.min(size3,Math.min(n1/2,size1)+Math.min(n2/2,size2));\n    }\n}\n```
['Array', 'Greedy', 'Java']