Skip to content

Contains solution for N-Queens Problem in Python running in O(N) time

Notifications You must be signed in to change notification settings

aarigela/N-Queens-Problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

nQueens.py : Solve the N-Queens problem

The N-queens problem is: 

  Given an empty NxN chessboard, place N queens on the board so that no queen can attack any other, i.e. such that no two queens share the same row, column or diagonal.

Sample output :-

[<username> ~]$ py nQueens.py 8
_ _ _ _ Q _ _ _
_ _ _ _ _ _ Q _
_ Q _ _ _ _ _ _
_ _ _ _ _ Q _ _
_ _ Q _ _ _ _ _
Q _ _ _ _ _ _ _
_ _ _ Q _ _ _ _
_ _ _ _ _ _ _ Q

Here, Q's indicate the positions of queens on the board.

About

Contains solution for N-Queens Problem in Python running in O(N) time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages