因为是按行排列的(for循环),所以我们不需要标记行,只需要标记列col和主副对角线diag1和diag2
P.S.今天看到一个比较正解的说法,关于递归和回溯:
It would be really interesting to see this backtracking done in an iterative way...
Backtracking = stack + iteration
回溯 = 栈+递归
确乎如此!
P.S.今天看到一个比较正解的说法,关于递归和回溯:
It would be really interesting to see this backtracking done in an iterative way...
Backtracking = stack + iteration
回溯 = 栈+递归
确乎如此!
本文标题:51.N-Queens
本文链接:https://www.haomeiwen.com/subject/muyxxhtx.html
网友评论