MCPcopy Create free account
hub / github.com/ByteByteGoHq/coding-interview-patterns / n_queens

Function n_queens

python3/Backtracking/n_queens.py:5–7  ·  view source on GitHub ↗
(n: int)

Source from the content-addressed store, hash-verified

3
4res = 0
5def n_queens(n: int) -> int:
6 dfs(0, set(), set(), set(), n)
7 return res
8
9def dfs(r: int, diagonals_set: Set[int], anti_diagonals_set: Set[int], cols_set: Set[int], n: int) -> None:
10 global res

Callers

nothing calls this directly

Calls 1

dfsFunction · 0.70

Tested by

no test coverage detected