描述:一个数组,前半部分之和和后半部分之和正好相等,找出中间的索引值。
You are given an array of numbers.
Find out the array index or position where sum of numbers preceding the index is equals to sum of numbers succeeding the index.
输出:
Starting from index 0, adding numbers till index 2 and adding rest of the numbers can be equal
代码部分:
package test;
import java.util.ArrayList;
/*
* You are given an array of numbers.
* Find out the array index or position where sum of numbers
* preceding the index is equals to sum of numbers succeeding the index.
*/
/*
* Example: Array: 2, 4, 4, 5, 4 ,1
* 2 + 4 + 4 = 5 + 4 + 1
* Means: from Index 0 to Index 2 where sum is equals to the following's summation.
*/
public