<awangdev>152. Maximum Product Subarray_1.java
public int maxProduct(int[] nums) {
        int n = nums.length;
        int[] maxProduct = new int[n], minProduct = new int[n];
        maxProduct[0] = nums[0];
        minProduct[0] = nums[0];
        int max = nums[0];
        for (int i = 1; i < n; i++) {
            int num = nums[i];
            if (num > 0) {
                maxProduct[i] = Math.max(num, maxProduct[i - 1] * num);
                minProduct[i] = Math.min(num, minProduct[i - 1] * num);
            } else {
                maxProduct[i] = Math.max(num, minProduct[i - 1] * num);
                minProduct[i] = Math.min(num, maxProduct[i - 1] * num);
            }
            max = Math.max(max, maxProduct[i]);
        }
        return max;
    }
public int sample_funcname ( int [ ] var_0 ) {
  int var_2 = var_0 . length ;
  int [ ] var_3 = new int [ var_2 ] , var_4 = new int [ var_2 ] ;
  var_3 [ 0 ] = var_0 [ 0 ] ;
  var_4 [ 0 ] = var_0 [ 0 ] ;
  int max = var_0 [ 0 ] ;
  for ( int var_8 = 1 ;
  var_8 < var_2 ;
  var_8 ++ ) {
    int var_9 = var_0 [ var_8 ] ;
    if ( var_9 > 0 ) {
      var_3 [ var_8 ] = Math . max ( var_9 , var_3 [ var_8 - 1 ] * var_9 ) ;
      var_4 [ var_8 ] = Math . min ( var_9 , var_4 [ var_8 - 1 ] * var_9 ) ;
    }
    else {
      var_3 [ var_8 ] = Math . max ( var_9 , var_4 [ var_8 - 1 ] * var_9 ) ;
      var_4 [ var_8 ] = Math . min ( var_9 , var_3 [ var_8 - 1 ] * var_9 ) ;
    }
    max = Math . max ( max , var_3 [ var_8 ] ) ;
  }
  return max ;
}
