[leetcode] N-Queens II
N-Queens II Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. tag: backtracking 此题与上一题非常相似,只是把“输出所有可能情况”改成了“输出所有可能情况的个数”。详细解析请看上一题的结题报告: N-Queens class Solution { public: int totalNQueens(int n) { if(n == 0){ return 0; } int queen[n] = {0}; int sum = 0; for(int i = 0; i < […]