One test case is showing tle

hey @Sadaf_khan0107 use optimzesolution
if Queen is placed in particular row then change row value


you can see this

@Monu-Singh-480654572341490
I think i have optimized my solution,
at line 26 in my code I’m changing the row value
u mean to say that if queen1 is placed in one row then no other queen will be placed in that row, i think i did that thing in my code at line 26
Even though I understood your code still,I want to know the prblm in my code

let N = 4
if(isItSafe(board,row,col)){
board[row][col]= true;
countQueen(board, row+1,0,qpsf+1, tq);
board[row][col]= false;
}
countQueen(board, row, col+1,qpsf, tq);
if row = 2 and col =0
Queeen is placed at (2,0)//countQueen(board, row+1,0,qpsf+1, tq);
There is no need to check whether the queen is placed on the index {(2,1) (2,2), (2,3)}

@Monu-Singh-480654572341490
if queen is placed at (2,0) then I am not checking {(2,1)(2,2)(2,3)}
I am moving to (3,0) nd checking if it is safe to place queen their nd then checking for
{(3,1),(3,2),(3,3)}

countQueen(board, row, col+1,qpsf, tq); // This recursive call will check {{2,1 (2,2) (2,3)}
There is any confusion. build stack memory or recursion tree

@Monu-Singh-480654572341490
ok i will build stack memory nd get back to u if their will be any confusion(may be on wtsapp)

@Sadaf_khan0107
okay