Skip to content

Instantly share code, notes, and snippets.

View vdnry's full-sized avatar
🤔

Vedant Ray vdnry

🤔
View GitHub Profile
@vdnry
vdnry / n_queens.py
Last active March 13, 2026 23:32
n_queens problem
from copy import deepcopy
def dfs_n_queens(n):
solutions = []
cache = {}
if n < 1:
return solutions
board = []
for _ in range(n):
board.append([0] * n)
_indices = []