C++ Solution || Easy || O(N)
Code\ncpp []\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) {\n        long long sum1 = 0, sum2 = 0;\n        long lon
# Code\n```cpp []\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) {\n        long long sum1 = 0, sum2 = 0;\n        long long count1 = 0, count2 = 0;\n\n        // Calculate sum1 and count1 for nums1\n        for (int i = 0; i < nums1.size(); i++) {\n            if (nums1[i] == 0) {\n                count1++;\n            }\n            sum1 += nums1[i];\n        }\n\n        // Calculate sum2 and count2 for nums2\n        for (int i = 0; i < nums2.size(); i++) {\n            if (nums2[i] == 0) {\n                count2++;\n            }\n            sum2 += nums2[i];\n        }\n        \n        // Corrected condition check\n        if ((count1 == 0 && (count2 + sum2 > sum1)) || (count2 == 0 && (count1 + sum1 > sum2))) {\n            return -1;\n        }\n\n        // Determine which sum is larger and return the result\n        if (sum1 + count1 > sum2 + count2) {\n            return sum1 + count1;\n        } else {\n            return sum2 + count2;\n        }\n    }\n};\n\n```
['C++']