~30m
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def minSum(self, nums1: List[int], nums2: List[int]) -> int:
        # sum after replacing becomes equal
        # return min equal sum, -1 if cant
        # check in which array we have bigger sum
        # for this array add 1's per each zero
        # minSum + 1 * (zeroCount) = min equal sum
        # add in second array the difference between existing sum and second sum.

        # return -1 if one array has no zeros and second array will at least have lower sum
        # than secondf

        sum1 = 0
        zeros1 = 0
        for num in nums1:
            sum1 += num
            if num == 0:
                zeros1 += 1

        sum2 = 0
        zeros2 = 0
        for num in nums2:
            sum2 += num
            if num == 0:
                zeros2 += 1

        res = 0
        if zeros1 > 0 and zeros2 > 0:
            res = max(sum2 + zeros2, sum1 + zeros1)
        elif zeros1 > 0:
            if (sum1 < sum2 and zeros1 <= sum2 - sum1):
                res = sum2
            else:
                res = -1
        elif zeros2 > 0:
            if (sum2 < sum1 and zeros2 <= sum1 - sum2):
                res = sum1
            else:
                res = -1
        else: 
            if (sum2 == sum1):
                res = sum2
            else: 
                res = -1

    
        # print(sum1, sum2, '<sums', 'zeroz>', zeros1, zeros2)
        # print(res, 'xd')

        return res
```
['Python3']