N QUEEN PROBLEM

Question:
The n-queens puzzle is the problem of placing n queens on a (n×n) chessboard such that no two queens can attack each other.
Given an integer n, find all distinct solutions to the n-queens puzzle. Each solution contains distinct board configurations of the n-queens’ placement, where the solutions are a permutation of [1,2,3…n] in increasing order, here the number in the ith place denotes that the ith-column queen is placed in the row with that number. For eg below figure represents a chessboard [3 1 4 2].

ATTEMPT LINK:https://ide.geeksforgeeks.org/auLzgDmGQk

PLEASE SIR HELP ME FIND OUT THE MISTAKE IN MY ATTEMPT

you are getting run time error because
you have not define the size of v vector
vector<int> v(n); after using this run time error will not be shown
but still your logic of isSafe() is not correct
for that you need complete board which you have not created

Sir, I have made some changes now in attempt link.
But still getting segmentation fault. I can’t understand where i am wrong. Please help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.