public static boolean isValid(int row, int col, int[] queens) {
		for (int i = 1; i < row; i++) {
			if (queens[i] != 0
					&& (queens[i] == col || (Math.abs(i - row) == Math
							.abs(queens[i] - col)))) {
				return false;
			}
		}

		return true;
	}