💯Greedy || ✨Clean & Easy Code✅
\n\n# Complexity\n\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n\n# Code\n## Please Upvote if u found it useful\uD83E\uDD17\n\nclass Solution {\npu
\n\n# Complexity\n```\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n```\n# Code\n## Please Upvote if u found it useful\uD83E\uDD17\n```\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) {\n        int c1 = 0, c2 = 0;\n        long s1 = 0, s2 = 0;\n        for(auto it : nums1){\n            if(it == 0)\n                c1++;\n            s1 += it;\n        }\n        for(auto it : nums2){\n            if(it == 0)\n                c2++;\n            s2 += it;\n        }\n        if(c1 == 0){\n            if(s1 < s2 + c2)\n                return -1;\n        }\n        if(c2 == 0){\n            if(s1 + c1 > s2)\n                return -1;\n        }\n        return max(s1 + c1, s2 + c2);\n    }\n};\n```
['Array', 'Greedy', 'C++']