Function to check whether the path exists
static Boolean hasPath ( int [ , ] maze , int [ , ] sol , int N ) { int i , j , k ; for ( i = 0 ; i < N ; i ++ ) for ( j = 0 ; j < N ; j ++ ) sol [ i , j ] = 0 ;