MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / dfs

Function dfs

CSES/Intro/CheesboardAndQueens.cc:29–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void dfs(int row,int col) {
30 if (col >= N) { cnt++; return; }
31
32 for (int i = 0; i < 8; ++i) {
33 if (grid[i][col] != '*' && is_safe(i,col)) {
34 grid[i][col] = 'G';
35 dfs(i,col+1);
36 grid[i][col] = '.';
37 }
38 }
39}
40
41int main(){
42 ios_base::sync_with_stdio(false),cin.tie(nullptr);

Callers 1

mainFunction · 0.70

Calls 1

is_safeFunction · 0.85

Tested by

no test coverage detected