O(n) solution by following hints
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nJust followed the hints given\n\n# Complexity\n- Time complexity:\nO(n)\n
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nJust followed the hints given\n\n# Complexity\n- Time complexity:\nO(n)\n\n\n\n# Code\n```python3 []\n\nclass Solution:\n    def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n\n        s1, c1, s2, c2 = 0,0,0,0\n\n        for num in nums1:\n            if num == 0:\n                s1 += 1\n                c1 += 1\n            else:\n                s1 += num\n        \n\n        for num in nums2:\n            if num == 0:\n                s2 += 1\n                c2 += 1\n            else:\n                s2 += num\n        \n\n        if s1 > s2:\n            if c2 == 0:\n                return -1\n            return s1\n        \n        elif s2 > s1:\n            if c1 == 0:\n                return -1\n            return s2\n        \n        else:\n            return s1 or s2\n             \n\n       \n        \n         \n\n        \n\n\n\n        \n        \n        \n        \n        \n        \n        \n```
['Python3']