✅💯🔥Simple Code🚀📌|| 🔥✔️Easy to understand🎯 || 🎓🧠Beats 100%🔥|| Beginner friendly💀💯
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public long minSum(int[] nums1, int[] nums2) {\n        int n= nums1.length;\n        int m = nums2.length;\n        long nsum=0; int nzeroes=0;\n        long msum=0; int mzeroes=0;\n        for(int i=0; i<n; i++){\n            nsum+=nums1[i];\n            if(nums1[i]==0){\n                nzeroes++;\n            }\n        }\n        for(int i=0; i<m; i++){\n            msum+=nums2[i];\n            if(nums2[i]==0){\n                mzeroes++;\n            }\n        }\n        return ((nzeroes==0 && nsum-mzeroes<msum)||(mzeroes==0 && msum-nzeroes<nsum)) ? -1 : Math.max(nzeroes+nsum, mzeroes+msum);\n    }\n}\n```\n\n![a9a682ef-8a56-461e-9e1b-7654b114838f_1721590703.0971212.jpeg](https://assets.leetcode.com/users/images/ccb19c02-b071-40be-997e-743de828dde4_1721851174.475046.jpeg)
['Array', 'Greedy', 'C', 'Python', 'C++', 'Java']