Driver Code
screen = [ [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 ] , [ 1 , 0 , 0 , 1 , 1 , 0 , 1 , 1 ] , [ 1 , 2 , 2 , 2 , 2 , 0 , 1 , 0 ] , [ 1 , 1 , 1 , 2 , 2 , 0 , 1 , 0 ] , [ 1 , 1 , 1 , 2 , 2 , 2 , 2 , 0 ] , [ 1 , 1 , 1 , 1 , 1 , 2 , 1 , 1 ] , [ 1 , 1 , 1 , 1 , 1 , 2 , 2 , 1 ] ] NEW_LINE x = 4 NEW_LINE y = 4 NEW_LINE newC = 3 NEW_LINE floodFill ( screen , x , y , newC ) NEW_LINE print ( " Updated ▁ screen ▁ after ▁ call ▁ to ▁ floodFill : " ) NEW_LINE for i in range ( M ) : NEW_LINE INDENT for j in range ( N ) : NEW_LINE INDENT print ( screen [ i ] [ j ] , end = ' ▁ ' ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT