Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
4
res = 0
5
def
n_queens(n: int) -> int:
6
dfs(0, set(), set(), set(), n)
7
return
res
8
9
def
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
dfs
Function · 0.70
Tested by
no test coverage detected