package leetcode;

/**
 * https://leetcode.com/problems/equal-sum-arrays-with-minimum-number-of-operations/
 */
public class Problem1775 {
    public int minOperations(int[] nums1, int[] nums2) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1775 prob = new Problem1775();
        System.out.println(prob.minOperations(new int[]{1,2,3,4,5,6}, new int[]{1,1,2,2,2,2})); // 3
        System.out.println(prob.minOperations(new int[]{1,1,1,1,1,1,1}, new int[]{6})); // -1
        System.out.println(prob.minOperations(new int[]{6,6}, new int[]{1})); // 3
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -227,32 +227,957 @@
     
-// TODO%0A        return 0
+if (nums1.length %3C nums2.length && 6 * nums1.length %3C nums2.length) %7B%0A            return -1;%0A        %7D else if (nums1.length %3E nums2.length && nums1.length %3E 6 * nums2.length) %7B%0A            return -1;%0A        %7D%0A        int sum1 = 0;%0A        for (int num : nums1) %7B%0A            sum1 += num;%0A        %7D%0A        int sum2 = 0;%0A        for (int num : nums2) %7B%0A            sum2 += num;%0A        %7D%0A        int answer = 0;%0A        if (sum1 %3C sum2) %7B%0A            Arrays.sort(nums1);%0A            for (int num : nums1) %7B%0A                sum1 += 6 - num;%0A                answer++;%0A                if (sum1 %3E= sum2) %7B%0A                    break;%0A                %7D%0A            %7D%0A        %7D else if (sum1 %3E sum2) %7B%0A            Arrays.sort(nums2);%0A            for (int num : nums2) %7B%0A                sum2 += 6 - num;%0A                answer++;%0A                if (sum2 %3E= sum1) %7B%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A        return answer
 ;%0A  

Update problem 1775