Tap here to switch tabs
Problem
Submissions

Problem: Find the Integer Added to Array II

med
30 min
Try to solve the Find the Integer Added to Array II problem.

Statement

You are given two integer arrays nums1 and nums2.

From nums1, exactly 22 elements are removed, and a single integer x is added to every remaining element. After these operations, the modified nums1 becomes equal to nums2, meaning both arrays contain the same values with identical frequencies.

Return the minimum possible integer x that satisfies this condition.

Constraints:

  • 3≤3 \leq nums1.length ≤200\leq 200

  • nums2.length ==== nums1.length −2- 2

  • 0≤0 \leq nums1[i], nums2[i] ≤1000\leq 1000

  • The test cases are generated such that at least one integer x exists that allows nums1 to become equal to nums2 after removing 22 elements and adding x to each remaining element.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Integer Added to Array II

med
30 min
Try to solve the Find the Integer Added to Array II problem.

Statement

You are given two integer arrays nums1 and nums2.

From nums1, exactly 22 elements are removed, and a single integer x is added to every remaining element. After these operations, the modified nums1 becomes equal to nums2, meaning both arrays contain the same values with identical frequencies.

Return the minimum possible integer x that satisfies this condition.

Constraints:

  • 3≤3 \leq nums1.length ≤200\leq 200

  • nums2.length ==== nums1.length −2- 2

  • 0≤0 \leq nums1[i], nums2[i] ≤1000\leq 1000

  • The test cases are generated such that at least one integer x exists that allows nums1 to become equal to nums2 after removing 22 elements and adding x to each remaining element.