Task:
An array is considered to be balanced if it can be divided into two parts so that the sum of the elements of the left-hand side is equal to the sum of the elements of the right-hand side. For example, the array [1, 1, 1, 2, 1] can be divided into two parts: [1, 1, 1] and [2, 1]. The sum of the elements of both parts is equal to 3, thus, the array is balanced. Continue reading