checking count of zeros and sums of both vectors
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:o(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:o(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) \n    {\n    int c = count(nums1.begin(), nums1.end(), 0);\n    int d= count(nums2.begin(), nums2.end(), 0);\n    long long sum1 = accumulate(nums1.begin(), nums1.end(), 0LL);\n    long long sum2 = accumulate(nums2.begin(), nums2.end(), 0LL); \n        \n       //boths zeros count are zero\n\n        if(c==0 && d==0)\n        {\n            if(sum1!=sum2)\n                return -1;\n            else\n                return sum1;\n        }\n        // boths zeros count are greater than 0 return max of them, as 0 are replaced by 1\n       else if(c>0 && d>0)\n        {\n            if(sum2+d>sum1+c)\n                return sum2+d;\n            else \n                return sum1+c;\n        }\n     //only one zeros count greater tha zero\n// eg [1,4] [1,1,0]  ans : 5\n// eg [1,4,0]  [1,1] ans : -1;\n        else if((c==0 && d!=0)  || ( c!=0 && d==0))\n        {\n            if(c==0)\n            {\n               if(sum2+d>sum1)   //[1,4] and [1,9,0]\n                   return -1;\n                else              //eg [1,4] [1,1,0] \n                    return sum1;\n            }\n            else          //opposite to c==0 condition\n            {\n                 if(sum1+c>sum2)\n                   return -1;\n                else\n                    return sum2;\n            }\n        }\n        return -1;\n    }\n};\n```
['Math', 'C++']