Keeps the track of unvisted cell having values 0
black_spots = 0 NEW_LINE for i in range ( 0 , N ) : NEW_LINE INDENT for j in range ( 0 , M ) : NEW_LINE INDENT if ( visited [ i ] [ j ] == False and mat [ i ] [ j ] == 0 ) : NEW_LINE DEDENT DEDENT