Greedy O(N) | Clean code
\n\n# Code\n\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2){\n        long long sum1 = 0 , sum2 = 0 , zeroes1 = 0 ,  z
\n\n# Code\n```\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2){\n        long long sum1 = 0 , sum2 = 0 , zeroes1 = 0 ,  zeroes2 = 0;\n        for(int num : nums1) sum1 += num , zeroes1 += num == 0;\n        for(int num : nums2) sum2 += num , zeroes2 += num == 0;\n        \n        if(zeroes1 == 0 && zeroes2 == 0){\n            if(sum1 == sum2) return sum1;\n            return -1;\n        }\n        \n        if(zeroes2 == 0) return (sum1 + zeroes1 > sum2) ? -1 : sum2;\n        if(zeroes1 == 0) return (sum2 + zeroes2 > sum1) ? -1 : sum1;\n        \n        return max(sum1 + zeroes1 , sum2 + zeroes2);\n        \n    }\n};\n```
['C++']