Counter and Sum
\n\n\n\n# Complexity\n- Time complexity: O(n1+n2)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[i
\n\n\n\n# Complexity\n- Time complexity: O(n1+n2)\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n        \n        c1,c2 = 0,0\n        for each in nums1:\n            if each == 0:\n                c1 += 1\n        for each in nums2:\n            if each == 0:\n                c2 += 1\n        \n        s1 = sum(nums1)\n        s2 = sum(nums2)\n        \n        if s1 + c1  == s2 + c2:\n            return s1 + c1\n        \n        if s1 + c1  > s2 + c2:\n            if c2 == 0:\n                return -1\n            return s1 + c1\n        else:\n            if c1 == 0:\n                return -1\n            return s2 + c2\n```
['Python3']