Tap here to switch tabs
Problem
Submissions

Problem: Equal Sum Arrays With Minimum Number of Operations

med
30 min
Try to solve the Equal Sum Arrays With Minimum Number of Operations problem.

Statement

You are given two arrays of integers, nums1 and nums2, where each element has a value between 11 and 66, inclusive.

In a single operation, you can select any element in either array and change its value to any integer between 11 and 66, inclusive.

Return the minimum number of operations needed to make the sum of elements in nums1 equal to the sum of elements in nums2. If it is impossible to make their sums equal, return −1-1.

Constraints:

  • 1≤1 \leq nums1.length, nums2.length ≤105\leq 10^5

  • 1≤1 \leq nums1[i], nums2[i] ≤6\leq 6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Equal Sum Arrays With Minimum Number of Operations

med
30 min
Try to solve the Equal Sum Arrays With Minimum Number of Operations problem.

Statement

You are given two arrays of integers, nums1 and nums2, where each element has a value between 11 and 66, inclusive.

In a single operation, you can select any element in either array and change its value to any integer between 11 and 66, inclusive.

Return the minimum number of operations needed to make the sum of elements in nums1 equal to the sum of elements in nums2. If it is impossible to make their sums equal, return −1-1.

Constraints:

  • 1≤1 \leq nums1.length, nums2.length ≤105\leq 10^5

  • 1≤1 \leq nums1[i], nums2[i] ≤6\leq 6