Given a 2D board containing
'O', capture all regions surrounded by
A region is captured by flipping all
'X's in that surrounded region.
First and only argument is a N x M character matrix A
make changes to the the input only as matrix is passed by reference.
1 <= N,M <= 1000
Input 1: A = [ [X, X, X, X], [X, O, O, X], [X, X, O, X], [X, O, X, X] ] Output 1: After running your function, the board should be: A = [ [X, X, X, X], [X, X, X, X], [X, X, X, X], [X, O, X, X] ] Explanation: 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.