#include <leetcode.h>
|
static void | dfs (const vector< vector< bool > > &board, int line, int n, vector< vector< string > > &ans) |
|
static vector< string > | toStringVec (const vector< vector< bool > > &board) |
|
static bool | valid (const vector< vector< bool > > &board, int n, int x, int y) |
|
◆ dfs()
void leetcode::n_queens::Solution::dfs |
( |
const vector< vector< bool > > & |
board, |
|
|
int |
line, |
|
|
int |
n, |
|
|
vector< vector< string > > & |
ans |
|
) |
| |
|
staticprivate |
在文件 leetcode.cpp 第 8315 行定义.
8320 for(
int i = 0; i < n; i++) {
8321 if(
valid(board, n, line, i)) {
8322 vector<vector<bool>> next = board;
8323 next[line][i] =
true;
8324 dfs(next, line + 1, n, ans);
static bool valid(const vector< vector< bool > > &board, int n, int x, int y)
static vector< string > toStringVec(const vector< vector< bool > > &board)
static void dfs(const vector< vector< bool > > &board, int line, int n, vector< vector< string > > &ans)
引用了 dfs(), toStringVec() , 以及 valid().
被这些函数引用 dfs() , 以及 solveNQueens().
◆ solveNQueens()
vector< vector< string > > leetcode::n_queens::Solution::solveNQueens |
( |
int |
n | ) |
|
|
static |
◆ toStringVec()
vector< string > leetcode::n_queens::Solution::toStringVec |
( |
const vector< vector< bool > > & |
board | ) |
|
|
staticprivate |
在文件 leetcode.cpp 第 8348 行定义.
8349 vector<string> ans(board.size());
8350 for(
int i = 0; i < board.size(); i++) {
8352 for(
int j = 0; j < board[i].size(); j++) {
8353 oss << (board[i][j] ?
'Q' :
'.');
被这些函数引用 dfs().
◆ valid()
bool leetcode::n_queens::Solution::valid |
( |
const vector< vector< bool > > & |
board, |
|
|
int |
n, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
|
staticprivate |
在文件 leetcode.cpp 第 8329 行定义.
8330 for(
int i = 0; i < x; i++) {
8335 for(
int i = x, j = y; i >= 0 && i < n && j >= 0 && j < n; i--, j--) {
8340 for(
int i = x, j = y; i >= 0 && i < n && j >= 0 && j < n; i--, j++) {
被这些函数引用 dfs().
该类的文档由以下文件生成: