Tap here to switch tabs
Problem
Submissions

Problem: Find the Integer Added to Array I

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

Statement

You are given two integer arrays nums1 and nums2 of equal length.

Every element in nums1 is increased by an integer x such that nums1 becomes equal to nums2, meaning both arrays contain the exact same elements after sorting.

Return the integer x.

Constraints:

  • 1≤1 \leq nums1.length == nums2.length ≤100\leq 100

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

  • The test cases are generated such that there exists an integer x where nums1 can become equal to nums2 after adding x to each element of nums1.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Integer Added to Array I

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

Statement

You are given two integer arrays nums1 and nums2 of equal length.

Every element in nums1 is increased by an integer x such that nums1 becomes equal to nums2, meaning both arrays contain the exact same elements after sorting.

Return the integer x.

Constraints:

  • 1≤1 \leq nums1.length == nums2.length ≤100\leq 100

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

  • The test cases are generated such that there exists an integer x where nums1 can become equal to nums2 after adding x to each element of nums1.