Queen Safety Check
Queen Safety Check
In the N-Queens puzzle the queens placed so far are stored as a list queens where queens[r] is the column of the queen in row r, one queen per row from the top. Write is_safe(queens: list[int], row: int, col: int) -> bool that returns True when a new queen at (row, col) is attacked by none of the queens in the rows above: for every earlier row r with column c, the new square is unsafe when c equals col (same column) or when the row distance row - r equals col - c or c - col (a diagonal). Rows never clash because each row holds one queen. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: three lines, the columns of the queens already placed (possibly empty), the row and the column to test; the tests print the boolean your function returns.
Expected Output:
True= newline. The output ends with a newline — print one after the last line.
Your Output
Run your code to see the output here...