Skip to content
Advertisement

Tag: n-queens

How to get better time complexity of N queens validator

How can we lower the time complexity of this solution of NxN queens matrix validator? I have this solution while I check every row and every column and every diagonal of the matrix. If every row and column has exactly 1 queen, and the matrix has no more than 1 queen the output is true. This solution works but I

Advertisement