Fundamentals/Load Balancer
← PrevNext →
Given an array containing only positive integers, determine if you can select two integers from the array that divide the array into three pieces such that the sum of the elements in all pieces is equal.
Examples
Example 1
Input[2, 4, 5, 3, 3, 9, 2, 2, 2]
Outputtrue
Explanation
Choosing the numbers 5 and 9 divides the array into three pieces [2, 4], [3, 3], and [2, 2, 2]. The sum of the elements in each piece is 6.
Example 2
Input[1, 1, 1, 1]
Outputfalse