|
1 | 1 | packagecom.fishercoder.solutions;
|
2 | 2 |
|
3 |
| -/** |
4 |
| - * 1013. Partition Array Into Three Parts With Equal Sum |
5 |
| - * |
6 |
| - * Given an array A of integers, return true if and only if we can partition the array into three non-empty parts with equal sums. |
7 |
| - * Formally, we can partition the array if we can find indexes i+1 < j with |
8 |
| - * (A[0] + A[1] + ... + A[i] == A[i+1] + A[i+2] + ... + A[j-1] == A[j] + A[j-1] + ... + A[A.length - 1]) |
9 |
| - * |
10 |
| - * Example 1: |
11 |
| - * Input: [0,2,1,-6,6,-7,9,1,2,0,1] |
12 |
| - * Output: true |
13 |
| - * Explanation: 0 + 2 + 1 = -6 + 6 - 7 + 9 + 1 = 2 + 0 + 1 |
14 |
| - * |
15 |
| - * Example 2: |
16 |
| - * Input: [0,2,1,-6,6,7,9,-1,2,0,1] |
17 |
| - * Output: false |
18 |
| - * |
19 |
| - * Example 3: |
20 |
| - * Input: [3,3,6,5,-2,2,5,1,-9,4] |
21 |
| - * Output: true |
22 |
| - * Explanation: 3 + 3 = 6 = 5 - 2 + 2 + 5 + 1 - 9 + 4 |
23 |
| - * |
24 |
| - * Note: |
25 |
| - * |
26 |
| - * 3 <= A.length <= 50000 |
27 |
| - * -10000 <= A[i] <= 10000*/ |
28 | 3 | publicclass_1013 {
|
29 | 4 | publicstaticclassSolution1 {
|
30 | 5 | publicbooleancanThreePartsEqualSum(int[]A) {
|
|