Class Solution
java.lang.Object
g1001_1100.s1013_partition_array_into_three_parts_with_equal_sum.Solution
1013 - Partition Array Into Three Parts With Equal Sum.<p>Easy</p>
<p>Given an array of integers <code>arr</code>, return <code>true</code> if we can partition the array into three <strong>non-empty</strong> parts with equal sums.</p>
<p>Formally, we can partition the array if we can find indexes <code>i + 1 < j</code> with <code>(arr[0] + arr[1] + ... + arr[i] == arr[i + 1] + arr[i + 2] + ... + arr[j - 1] == arr[j] + arr[j + 1] + ... + arr[arr.length - 1])</code></p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> arr = [0,2,1,-6,6,-7,9,1,2,0,1]</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> 0 + 2 + 1 = -6 + 6 - 7 + 9 + 1 = 2 + 0 + 1</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> arr = [0,2,1,-6,6,7,9,-1,2,0,1]</p>
<p><strong>Output:</strong> false</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> arr = [3,3,6,5,-2,2,5,1,-9,4]</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> 3 + 3 = 6 = 5 - 2 + 2 + 5 + 1 - 9 + 4</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>3 <= arr.length <= 5 * 10<sup>4</sup></code></li>
<li><code>-10<sup>4</sup> <= arr[i] <= 10<sup>4</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
canThreePartsEqualSum
public boolean canThreePartsEqualSum(int[] arr)
-