According to the problem, if the sum of all elements to the left of the chosen index equals the sum of all elements to the right, then moving left or right both work. If the left sum is greater than the right sum by 1, or the right sum is greater than the left sum by 1, then only the larger side can be chosen. Use prefix sum to quickly compute the sum of array elements.