MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / n_queens_solution

Function n_queens_solution

backtracking/n_queens_math.py:141–151  ·  view source on GitHub ↗
(n: int)

Source from the content-addressed store, hash-verified

139
140
141def n_queens_solution(n: int) -> None:
142 boards: list[list[str]] = []
143 depth_first_search([], [], [], boards, n)
144
145 # Print all the boards
146 for board in boards:
147 for column in board:
148 print(column)
149 print("")
150
151 print(len(boards), "solutions were found.")
152
153
154if __name__ == "__main__":

Callers 1

n_queens_math.pyFile · 0.85

Calls 1

depth_first_searchFunction · 0.70

Tested by

no test coverage detected