Skip to content

Instantly share code, notes, and snippets.

@sYnfo
Created July 22, 2015 10:56
Show Gist options
  • Save sYnfo/26a182994cf3294b2ab9 to your computer and use it in GitHub Desktop.
Save sYnfo/26a182994cf3294b2ab9 to your computer and use it in GitHub Desktop.
N-queens
len([v for v in permutations(range(n)) if n == len(set(v[i]+i for i in range(n))) == len(set(v[i]-i for i in range(n)))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment