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

Function main

CPP/recursion/N_Queens/N_Queens.cpp:113–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113int main()
114{
115
116 int n = 0;
117 // Input Size of the chessboard
118 // No of queens will be the same as size n.
119 std::cin >> n;
120 if (n <= 3)
121 {
122 std::cout << "No solution exists for n = " << n << std::endl;
123 }
124 // 2D vector for storing board having size max size of nXn.
125 // First create a column vector of size n.
126 std::vector<int> column(n);
127 // Create Row vectors and fill rows with columns.
128 std::vector<std::vector<int>> board(n, column);
129
130 // Function call for
131 // Arguments passed are : 2D vector board
132 // : No of queens
133 // : Starting row.
134 N_Queens(board, n, 0);
135
136 return 0;
137}

Callers

nothing calls this directly

Calls 1

N_QueensFunction · 0.85

Tested by

no test coverage detected