simple o(n) python3 solution
Approach\nYou can think of the possible sums for each list of numbers as belonging to range where, if the list contains at least one zero, the range is [initial
# Approach\nYou can think of the possible sums for each list of numbers as belonging to range where, if the list contains at least one zero, the range is [initial_sum + number of zeroes, infinity], otherwise, it is [initial_sum, initial_sum]. To have an equivalent sum for our lists of numbers, the ranges must overlap. So we produce the possible range for each list and check that they overlap. If they do, we return the minimum number belonging to each range, which is just the greater of the two starting values. \n\n# Complexity\n- Time complexity:\n$$O(n) + O(m)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        n1_sum, n1_zeroes = sum(nums1), nums1.count(0)\n        n2_sum, n2_zeroes = sum(nums2), nums2.count(0)\n        n1_minsum, n2_minsum = n1_sum + n1_zeroes, n2_sum + n2_zeroes\n\n        if (not n1_zeroes and n1_minsum < n2_minsum) or (not n2_zeroes and n2_minsum < n1_minsum):\n            return -1\n        \n        return max(n1_minsum, n2_minsum)\n        \n```
['Python3']