private static int[][] removeRowAndCol(int[][] matrix, int row, int col){
		//preconditions
		if(matrix == null)throw new IllegalArgumentException("matrix must not be null");
		for(int i = 0; i < matrix.length; i++){
			if(matrix.length != matrix[i].length)throw new IllegalArgumentException("matrix must be square!");
		}
		if(matrix.length <= 2)throw new IllegalArgumentException("matrix must be at least 3x3");
		
		int[][] newMatrix = new int[matrix.length-1][matrix.length-1];
		for(int i = 0, ni = 0; i < matrix.length; i++){
			
			if(i != row){
				for(int j = 0, nj = 0; j < matrix.length; j++){
					if(j != col){
						newMatrix[ni][nj] = matrix[i][j];
						nj++;
					}
				}
				ni++;
			}
		}
		return newMatrix;
	}