Left cell
if ( isValid ( grid , cellRow , cellCol - 1 ) ) { que . push ( make_pair ( cellRow , cellCol - 1 ) ) ; minDistance [ cellRow ] [ cellCol - 1 ] = min ( minDistance [ cellRow ] [ cellCol - 1 ] , minDistance [ cellRow ] [ cellCol ] + 1 ) ; visited [ cellRow ] [ cellCol - 1 ] = 1 ; }