It's a math question
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
![image.png](https://assets.leetcode.com/users/images/cbf8b644-cd4d-43e1-9912-f0855cfbb033_1739217399.0052454.png)

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```csharp []
public class Solution {
    public int MaximumSetSize(int[] nums1, int[] nums2) {
        int len1 = nums1.Length, len2 = nums2.Length;
        HashSet<int> dist1 = new HashSet<int>(nums1), dist2 = new HashSet<int>(nums2);
        int comm = 0;
        foreach(int n in dist2)
        {
            if(dist1.Contains(n))
                comm++;
        }

        int only1 = dist1.Count-comm, only2 = dist2.Count-comm;
        int res = Math.Min(len1/2, only1) + Math.Min(len2/2, only2);
        int rest = Math.Min(len1/2+len2/2-res, comm);

        return res+rest;
    }
}
```
['C#']