100% faster , just loops and iteration
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        long sum1 =0,sum2=0;\n        int ans=0;\n        int cnt1 =0;\n        int cnt2=0;\n        for(int i =0; i< nums1.length ; i++){\n            if(nums1[i]==0) cnt1++;\n    \n          sum1+=nums1[i];\n        }\n    \n        for(int i =0; i< nums2.length ; i++){\n            if(nums2[i]==0) cnt2++;\n          sum2+=nums2[i];\n        }\n      if((cnt1==0 && sum1-cnt2<sum2)|| (cnt2==0 && sum2-cnt1<sum1)) return -1;\n\n      return Math.max(sum1+cnt1,sum2+cnt2);\n    }\n}\n```
['Java']