A utility function to check if i , j are valid indexes for N * N chessboard
static bool isSafe ( int x , int y , int [ , ] sol ) { return ( x >= 0 && x < N && y >= 0 && y < N && sol [ x , y ] == - 1 ) ; }