Re: [algogeeks] Amazon problem

2013-06-19 Thread bharat b
Start BFS from a position which is 'o'. the neighbour elements are as defined in the question. Mark neighbour as 'Z' if it is not a boundary and either 'x' or 'o', else *failure*. If there is no more for the considered connected component *and if it is* *success*, then mark all 'Z's to 'x'. Do this

Re: [algogeeks] Amazon problem

2013-06-19 Thread bharat b
sorry.. pls ignore the above post.. that doesn't work.. On Wed, Jun 19, 2013 at 10:5 5 PM, bharat b wrote: > If I understood the problem, the following works fine. > if(A[i][j] == 'o' and it is not and edge element) { > if(A[i][j] is surrounded by either 'x' or 'o') { > A[i][j] = 'x'; > }

Re: [algogeeks] Amazon problem

2013-06-19 Thread bharat b
If I understood the problem, the following works fine. if(A[i][j] == 'o' and it is not and edge element) { if(A[i][j] is surrounded by either 'x' or 'o') { A[i][j] = 'x'; } } On Mon, Jun 10, 2013 at 8:38 PM, Jai Shri Ram wrote: > Given a 2D board containing 'X' and 'O', capture all regio