public static int uniquePaths2(int m, int n) {
		int[][] pathMatrix = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (i == 0 && j == 0) {
					pathMatrix[0][0] = 1;
				} else if (i == 0 && j != 0) {
					pathMatrix[i][j] = pathMatrix[i][j - 1];
				} else if (j == 0 && i != 0) {
					pathMatrix[i][j] = pathMatrix[i - 1][j];
				} else {
					pathMatrix[i][j] = pathMatrix[i - 1][j]
							+ pathMatrix[i][j - 1];
				}
			}
		}
		return pathMatrix[m - 1][n - 1];
	}