Greedy Approach
IntuitionGreedily give lowest possible value of positive value to zero places ie 1, and try to make the minPositive Sum equal, by handling edge cases.ApproachAn
# Intuition
Greedily give lowest possible value of positive value to zero places ie 1, and try to make the minPositive Sum equal, by handling edge cases.

# Approach

Any 2 arrays can be made equal sum , if they then arr with lower sum have atleast 1 zero , by covering the positive difference to the index having zero in the array with lower sum,

- `If cal the min non- zero element sum ,ie be greedy & assign lowest positive value = 1 , if both have same sum then return the sum value (ie equal for both)`
- If aSum != bSum 
can be made equal if the one with lowerSum , have atleast one zero and if not return -1

<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(n + m) , lengths of 2 nums
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(n*2) = O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public long[] sumAndCnt(int[] nums){
        long res[] = {0,0}; // totalSum , zeroPlaces cnt
        for (int i =  0; i <nums.length ; i++){
            int n = nums[i];
            if (n <= 0) {
                res[0] += 1;
                res[1] += 1;// 0 places
            }
            else {
                res[0] += n;
            }
        }
        return res;
    }
    
    public long minSum(int[] nums1, int[] nums2) {
        long[] a = sumAndCnt(nums1);
        long[] b = sumAndCnt(nums2);
        long aSum = a[0] , a0 = a[1];
        long bSum = b[0] , b0 = b[1];

        if ( aSum == bSum ) return aSum ;

        if (aSum < bSum && a0 == 0 ) return -1;
        if (bSum < aSum && b0 == 0 ) return -1;
        

        return Math.max(aSum , bSum);
        
        
    }
}
```
['Java']