EASY BEGINEER FRIENDLY ✅|| C++
\n# Code\n\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) {\n        int flag1=0,flag2=0;\n        long long sum1=0,su
\n# Code\n```\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) {\n        int flag1=0,flag2=0;\n        long long sum1=0,sum2=0;\n        \n        // saving sum of both nums1 and nums2\n        \n        for(auto i:nums1){\n            if(i==0){\n                sum1+=1;\n                flag1++;\n            }\n            else sum1+=i;\n        }\n        \n        for(auto i:nums2){\n            if(i==0){\n                sum2+=1;\n                flag2++;\n            }\n            else sum2+=i;\n        }\n        if(sum1==sum2) return sum1;\n        if(flag1>0 && flag2>0){\n            return max(sum1,sum2);\n        }\n        \n        if(flag1>0 && flag2==0){\n            if(sum2>=sum1)\n                return sum2;\n            else return -1;\n        }\n        \n         if(flag2>0 && flag1==0){\n            if(sum1>=sum2)\n                return sum1;\n            else return -1;\n        }\n        \n        return -1;\n        \n    }\n}; \n```
['C++']