public static int minPathDP1D(int[][] grid) {
		if( grid == null || grid.length == 0) {
			return 0;
		}
		int rLen = grid.length;
		int cLen = grid[0].length;
		int[] minSum = new int[cLen];
		for (int i = 0; i < rLen; i ++) {
			for (int j = 0; j < cLen; j++) {
				if (i == 0 && j == 0) {
					minSum[0] = grid[0][0];
				} else if (j == 0) {
					minSum[j] = minSum[j] + grid[i][j];
				}else if ( i == 0) {
					minSum[j] = minSum[j-1] + grid[i][j];
				}else {
					minSum[j] = Math.min(minSum[j-1] , minSum[j]) + grid[i][j];
				}
			}
		}
		return minSum[cLen - 1];
	}