<gouthampradhan>array_FindPivotIndex_1.java
public int pivotIndex(int[] nums) {
    if (nums.length == 1) return 0;
    int[] left = new int[nums.length];
    int[] right = new int[nums.length];
    left[0] = nums[0];
    for (int i = 1; i < nums.length; i++) {
      left[i] = left[i - 1] + nums[i];
    }
    right[nums.length - 1] = nums[nums.length - 1];
    for (int i = nums.length - 2; i >= 0; i--) {
      right[i] = right[i + 1] + nums[i];
    }
    for (int i = 0; i < nums.length; i++) {
      int l, r;
      if (i == 0) {
        l = 0;
      } else {
        l = left[i - 1];
      }
      if (i == nums.length - 1) {
        r = 0;
      } else {
        r = right[i + 1];
      }
      if (l == r) return i;
    }
    return -1;
  }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 . length == 1 ) return 0 ;
  int [ ] var_4 = new int [ var_0 . length ] ;
  int [ ] var_5 = new int [ var_0 . length ] ;
  var_4 [ 0 ] = var_0 [ 0 ] ;
  for ( int var_6 = 1 ;
  var_6 < var_0 . length ;
  var_6 ++ ) {
    var_4 [ var_6 ] = var_4 [ var_6 - 1 ] + var_0 [ var_6 ] ;
  }
  var_5 [ var_0 . length - 1 ] = var_0 [ var_0 . length - 1 ] ;
  for ( int var_6 = var_0 . length - 2 ;
  var_6 >= 0 ;
  var_6 -- ) {
    var_5 [ var_6 ] = var_5 [ var_6 + 1 ] + var_0 [ var_6 ] ;
  }
  for ( int var_6 = 0 ;
  var_6 < var_0 . length ;
  var_6 ++ ) {
    int var_8 , var_9 ;
    if ( var_6 == 0 ) {
      var_8 = 0 ;
    }
    else {
      var_8 = var_4 [ var_6 - 1 ] ;
    }
    if ( var_6 == var_0 . length - 1 ) {
      var_9 = 0 ;
    }
    else {
      var_9 = var_5 [ var_6 + 1 ] ;
    }
    if ( var_8 == var_9 ) return var_6 ;
  }
  return - 1 ;
}
