<awangdev>House Robber II_5.java
public int rob(int[] nums) {
        if (nums == null || nums.length == 0) {
        	return 0;
        } else if (nums.length == 1) {
        	return nums[0];
        } else if (nums.length == 2) {
            return Math.max(nums[0], nums[1]);
        }

        int n = nums.length;

        int[] dp1 = new int[n];
        dp1[0] = nums[0];
        dp1[1] = Math.max(nums[0], nums[1]);
        for (int i = 2; i < n - 1; i++) {
        	dp1[i] = Math.max(dp1[i - 1], dp1[i - 2] + nums[i]);
        }
        dp1[n - 1] = dp1[n - 2];

        int[] dp2 = new int[n];
        dp2[0] = 0;
        dp2[1] = nums[1];
        for (int i = 2; i < n - 2; i++) {
        	dp2[i] = Math.max(dp2[i - 1], dp2[i - 2] + nums[i]);
        }
        dp2[n - 1] = dp2[n - 3] + nums[n - 1];

        return Math.max(dp2[n - 1], dp1[n - 1]);
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  else if ( var_0 . length == 1 ) {
    return var_0 [ 0 ] ;
  }
  else if ( var_0 . length == 2 ) {
    return Math . max ( var_0 [ 0 ] , var_0 [ 1 ] ) ;
  }
  int var_8 = var_0 . length ;
  int [ ] var_9 = new int [ var_8 ] ;
  var_9 [ 0 ] = var_0 [ 0 ] ;
  var_9 [ 1 ] = Math . max ( var_0 [ 0 ] , var_0 [ 1 ] ) ;
  for ( int var_10 = 2 ;
  var_10 < var_8 - 1 ;
  var_10 ++ ) {
    var_9 [ var_10 ] = Math . max ( var_9 [ var_10 - 1 ] , var_9 [ var_10 - 2 ] + var_0 [ var_10 ] ) ;
  }
  var_9 [ var_8 - 1 ] = var_9 [ var_8 - 2 ] ;
  int [ ] var_11 = new int [ var_8 ] ;
  var_11 [ 0 ] = 0 ;
  var_11 [ 1 ] = var_0 [ 1 ] ;
  for ( int var_10 = 2 ;
  var_10 < var_8 - 2 ;
  var_10 ++ ) {
    var_11 [ var_10 ] = Math . max ( var_11 [ var_10 - 1 ] , var_11 [ var_10 - 2 ] + var_0 [ var_10 ] ) ;
  }
  var_11 [ var_8 - 1 ] = var_11 [ var_8 - 3 ] + var_0 [ var_8 - 1 ] ;
  return Math . max ( var_11 [ var_8 - 1 ] , var_9 [ var_8 - 1 ] ) ;
}
