<awangdev>724. Find Pivot Index_1.java
public int pivotIndex(int[] nums) {
        if (nums == null || nums.length == 0) return -1;
        int n = nums.length;
        for (int i = 1; i < n; i++) nums[i] += nums[i - 1];

        if (nums[n-1] - nums[0] == 0) return 0;
        
        for (int i = 1; i < n; i++) {
            if (nums[i - 1] == nums[n - 1] - nums[i]) return i;
        }
        
        return -1;
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) return - 1 ;
  int var_5 = var_0 . length ;
  for ( int var_6 = 1 ;
  var_6 < var_5 ;
  var_6 ++ ) var_0 [ var_6 ] += var_0 [ var_6 - 1 ] ;
  if ( var_0 [ var_5 - 1 ] - var_0 [ 0 ] == 0 ) return 0 ;
  for ( int var_6 = 1 ;
  var_6 < var_5 ;
  var_6 ++ ) {
    if ( var_0 [ var_6 - 1 ] == var_0 [ var_5 - 1 ] - var_0 [ var_6 ] ) return var_6 ;
  }
  return - 1 ;
}
