Practice Minimum Equal Sum of Two Arrays After Replacing Zeros
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two arrays nums1 and nums2 consisting of positive integers. You have to replace all the 0's in both arrays with strictly positive integers such that the sum of elements of both arrays becomes equal. Return the minimum equal sum you can obtain, or -1 if it is impossible.
Source: Minimum Equal Sum of Two Arrays After Replacing Zeros on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums1 = [3,2,0,1,0], nums2 = [6,5,0]
12
# Example 2
nums1 = [2,0,2,0], nums2 = [1,4]
-1
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Equal Sum of Two Arrays After Replacing Zeros.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.