Easy to understand Python Solution | O(N)
Intuition\nSimply count the number of zeros in each array and add them up with the sums respectively.\nPost that there is only one edge case where one array has
# Intuition\nSimply count the number of zeros in each array and add them up with the sums respectively.\nPost that there is only one edge case where one array has no zeros present and the sum of second array is greater than that array. In that case, there is no possibity to build equal sum so we simply return zero. Otherwise just return the maximum of the two sums computed before, as we can easily adjust any number with given zeros.\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        zeroCount1, zeroCount2, sum1, sum2 = 0, 0, 0, 0\n\n        for num in nums1:\n            zeroCount1 += 1 if num == 0 else 0\n            sum1 += num\n        \n        for num in nums2:\n            zeroCount2 += 1 if num == 0 else 0\n            sum2 += num\n        sum1 += zeroCount1\n        sum2 += zeroCount2\n\n        if (zeroCount1 == 0 and sum2 > sum1) or (zeroCount2 == 0 and sum1 > sum2):\n            return -1\n        return max(sum1, sum2)\n\n```
['Array', 'Python3']