Right cell
if ( isValid ( grid , cellRow , cellCol + 1 ) ) : NEW_LINE INDENT que . appendleft ( [ cellRow , cellCol + 1 ] ) NEW_LINE minDistance [ cellRow ] [ cellCol + 1 ] = min ( minDistance [ cellRow ] [ cellCol + 1 ] , minDistance [ cellRow ] [ cellCol ] + 1 ) NEW_LINE visited [ cellRow ] [ cellCol + 1 ] = 1 ; NEW_LINE DEDENT