<awangdev>Maximum Subarray III_1.java
public int maxSubArray(int[] nums, int k) {
        if (nums == null || nums.length == 0) {
            return 0;
        }
        int n = nums.length;
        int[][] dp = new int[n + 1][k + 1];

        for (int j = 1; j <= k; j++) {
            for (int i = j; i <= n; i++) { 
                dp[i][j] = Integer.MIN_VALUE;

                int endMax = 0;
                int max = Integer.MIN_VALUE;
                for (int x = i - 1; x >= j - 1; x--) { 
                    endMax = Math.max(nums[x], nums[x] + endMax);
                    max = Math.max(max, endMax);
                    dp[i][j] = dp[i][j] < dp[x][j - 1] + max ? dp[x][j - 1] + max : dp[i][j];
                }
            }
        }
        return dp[n][k];
    }
public int sample_funcname ( int [ ] var_0 , int var_1 ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  int var_5 = var_0 . length ;
  int [ ] [ ] var_7 = new int [ var_5 + 1 ] [ var_1 + 1 ] ;
  for ( int var_8 = 1 ;
  var_8 <= var_1 ;
  var_8 ++ ) {
    for ( int var_9 = var_8 ;
    var_9 <= var_5 ;
    var_9 ++ ) {
      var_7 [ var_9 ] [ var_8 ] = Integer . MIN_VALUE ;
      int var_12 = 0 ;
      int max = Integer . MIN_VALUE ;
      for ( int var_14 = var_9 - 1 ;
      var_14 >= var_8 - 1 ;
      var_14 -- ) {
        var_12 = Math . max ( var_0 [ var_14 ] , var_0 [ var_14 ] + var_12 ) ;
        max = Math . max ( max , var_12 ) ;
        var_7 [ var_9 ] [ var_8 ] = var_7 [ var_9 ] [ var_8 ] < var_7 [ var_14 ] [ var_8 - 1 ] + max ? var_7 [ var_14 ] [ var_8 - 1 ] + max : var_7 [ var_9 ] [ var_8 ] ;
      }
    }
  }
  return var_7 [ var_5 ] [ var_1 ] ;
}
