Given a 2D character matrix A of size
N x M, containing
'O', capture all regions surrounded by
A region is captured by flipping all
'X's in that surrounded region.
1 <= N, M <= 103
First and only argument 2D character matrix A of size
N X M.
Make changes to the the input only as matrix is passed by reference.
A = [ [X, X, X, X], [X, O, O, X], [X, X, O, X], [X, O, X, X] ]
A = [ [X, X, X, X], [X, X, X, X], [X, X, X, X], [X, O, X, X] ]
'O' in (4,2) is not surrounded by X from below.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.