package leetcode;

/**
 * https://leetcode.com/problems/partition-array-into-three-parts-with-equal-sum/
 */
public class Problem1020 {
    public boolean canThreePartsEqualSum(int[] A) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1020 prob = new Problem1020();
        System.out.println(prob.canThreePartsEqualSum(new int[]{0, 2, 1, -6, 6, -7, 9, 1, 2, 0, 1})); // true
        System.out.println(prob.canThreePartsEqualSum(new int[]{0, 2, 1, -6, 6, 7, 9, -1, 2, 0, 1})); // fals
        System.out.println(prob.canThreePartsEqualSum(new int[]{3, 3, 6, 5, -2, 2, 5, 1, -9, 4})); // true
    }
}

@@ -193,15 +193,269 @@
     
-// TODO
+int sum = 0;%0A        for (int a : A) %7B%0A            sum += a;%0A        %7D%0A        int part = 0;%0A        for (int a : A) %7B%0A            part += a;%0A            if (part != 0 && sum %25 part == 0 && sum / part == 3) %7B%0A                return true;%0A            %7D%0A        %7D
 %0A   
@@ -571,16 +571,18 @@
 1020();%0A
+//
         
@@ -679,24 +679,26 @@
 )); // true%0A
+//
         Syst
@@ -794,17 +794,20 @@
  // fals
-%0A
+e%0A//
         
@@ -905,16 +905,205 @@
 // true%0A
+//        System.out.println(prob.canThreePartsEqualSum(new int%5B%5D%7B0, 0, 0, 0, 0%7D)); // true%0A        System.out.println(prob.canThreePartsEqualSum(new int%5B%5D%7B0, 0, -3, 0, 3, 0, 0%7D)); // true%0A
     %7D%0A%7D%0A

Update problem 1020