hey i can able to resolve my error can you help me in resolving
#include
#include
using namespace std;
bool canPlace(int mat[][n],int i,int j,int n,int number){
for(int x=0;x<n;x++){
//Row column check
if(mat[x][j] == number || mat[i][x] == number){
return false;
}
}
int rn =sqrt(n);
int sx = (i/rn)*rn;
int sy = (j/rn)*rn;
for(int x = sx;x<sx+rn;x++){
for(int y=sy;y<sy+rn;y++){
if(mat[x][y] == number){
return false;
}
}
}
return true;
}
bool SolveSudoku(int mat[][n],int i,int j,int n){
//base case
if(i==n){
//print the matrix
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<mat[i][j]<<" ";
}
cout<<endl;
}
return true;
}
//column end
if(j==n){
SolveSudoku(mat,i+1,0,n);
}
//skipping the pre-filled cells;
if(mat[i][j] != 0){
SolveSudoku(mat,i,j+1,n);
}
//recursive case
//placing the number where 0
for(int number=1;i<n;i++){
if(canPlace(mat,i,j,n,number)){
//assume
mat[i][j] = number;
bool couldPlace = SolveSudoku(mat,i,j+1,n);
if(couldPlace==true){
return true;
}
}
}
//backtrack
mat[i][j] = 0;
return false;
}
int main() {
int n;
cin>>n;
cout<<n<<" ";
int mat[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>mat[i][j];
}
}
//call SolveSudoku functio
SolveSudoku(mat,0,0,n);
return 0;
}