O(n) python soln
\n# Code\npython3 []\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        ct1 = 0\n        sum1 = 0\n        for i in num
\n# Code\n```python3 []\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        ct1 = 0\n        sum1 = 0\n        for i in nums1:\n            if i == 0:\n                ct1 +=1\n            sum1+=i\n        ct2 = 0\n        sum2 = 0\n        for i in nums2:\n            if i == 0:\n                ct2 +=1\n            sum2+=i\n        if (ct1 == 0 and sum1 < sum2+ct2) or (ct2 == 0 and sum2 < sum1+ct1):\n            return -1\n        return max(sum1+ct1, sum2+ct2)\n        \n```
['Python3']