Question: In the eight queens problem, suppose the 8 x 8 chess board is represented as an 8 x 8 int array (e.g., int board[8][8]), board[i][j]

In the eight queens problem, suppose the 8 x 8 chess board is represented as an 8 x 8 int array (e.g., int board[8][8]), board[i][j] is assigned with 1 if we place a queen at row i and column j. board[i][j] will be 0 if it is empty. Write a function to determine if we can place a new queen at row x and column y so that this new queen will not attack any queens above row x. The function prototype is given as the following: bool canPlaceQueen(int board[][8], int row, int col); (Hint: This function should return false if it finds any queen above [row][col] or on the left and right diagonal of the square defined by [row][col], return true if no conflict is found in all three directions.)

C+++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!