Skip to content

Instantly share code, notes, and snippets.

View protectroot-com's full-sized avatar

ProtectRoot.com protectroot-com

View GitHub Profile
@protectroot-com
protectroot-com / backtracking_template.py
Created February 19, 2022 16:54 — forked from RuolinZheng08/backtracking_template.py
[Algo] Backtracking Template & N-Queens Solution
def is_valid_state(state):
# check if it is a valid solution
return True
def get_candidates(state):
return []
def search(state, solutions):
if is_valid_state(state):
solutions.append(state.copy())