Tap here to switch tabs
Problem
Submissions

Problem: Maximum Size of a Set After Removals

Maximum Size of a Set After Removals asks you to remove half the elements from each of two equal-length arrays and return the largest possible set of distinct remaining values.

Statement

You are given two 00 indexed integer arrays, nums1 and nums2, each having an even length n.

You must remove n/2n / 2 elements from nums1 and n/2n / 2 elements from nums2. After the removals, all remaining elements from both arrays are placed into a set s.

Return the maximum possible number of elements in the set s.

Constraints:

  • n == nums1.length == nums2.length

  • 1≤1 \leq n ≤2×104\leq 2 \times 10^4

  • n is even.

  • 1≤1 \leq nums1[i], nums2[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Size of a Set After Removals

Maximum Size of a Set After Removals asks you to remove half the elements from each of two equal-length arrays and return the largest possible set of distinct remaining values.

Statement

You are given two 00 indexed integer arrays, nums1 and nums2, each having an even length n.

You must remove n/2n / 2 elements from nums1 and n/2n / 2 elements from nums2. After the removals, all remaining elements from both arrays are placed into a set s.

Return the maximum possible number of elements in the set s.

Constraints:

  • n == nums1.length == nums2.length

  • 1≤1 \leq n ≤2×104\leq 2 \times 10^4

  • n is even.

  • 1≤1 \leq nums1[i], nums2[i] ≤109\leq 10^9