Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- queensSolutions
- ================
- Solve the famous n queens puzzle with bitwise.
- For example, solving an eight queens puzzle, the input should be 255 (11111111 bin), and the output will return an array which contains all the solutions formed as strings.
- One of the solutions of the above exapmle is like "1,16,128,32,4,64,2,8". After spliting with the separator ",", it becomes ["1", "16", "128", "32", "4", "64", "2", "8"].
- Now it looks like this:
- 1
- 16
- 128
- 32
- 4
- 64
- 2
- 8
- In binary form:
- 00000001
- 00010000
- 10000000
- 00100000
- 00000100
- 01000000
- 00000010
- 00001000
- where 1 are queens.
Add Comment
Please, Sign In to add comment