/求一個整形數組中一個index,index左邊的和 等於index 右邊的和/數組
public int pivotIndex(int[] nums) { long sum=0; for(int s:nums){ sum +=s;} long crunSum=0; for(int i =0; i<nums.length; i++){ if( (sum - crunSum-nums[i]) == crunSum ){ return i;} crunSum += nums[i]; } return -1; }