Now use BFS to find if there is any possible path or not . Initialize the queue which holds the discovered cells whose neighbors are not discovered yet .
vector < vector < int > > qu ; rect [ 0 ] [ 0 ] = 1 ; qu . push_back ( { 0 , 0 } ) ;