Tap here to switch tabs
Problem
Submissions

Problem: Maximum Size of a Set After Removals

med
30 min
Try to solve the Maximum Size of a Set After Removals problem.

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 ≤2imes104\leq 2 imes 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

med
30 min
Try to solve the Maximum Size of a Set After Removals problem.

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 ≤2imes104\leq 2 imes 10^4

  • n is even.

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