Re: [algogeeks] Amazon problem
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 del7...@gmail.com wrote: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region . For example, X X X X X O O X X X O X X O X X After running your function, the board should be: X X X X X X X X X X X X X O X X -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
Re: [algogeeks] Amazon problem
sorry.. pls ignore the above post.. that doesn't work.. On Wed, Jun 19, 2013 at 10:5 5 PM, bharat b bagana.bharatku...@gmail.com 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'; } } On Mon, Jun 10, 2013 at 8:38 PM, Jai Shri Ram del7...@gmail.com wrote: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region . For example, X X X X X O O X X X O X X O X X After running your function, the board should be: X X X X X X X X X X X X X O X X -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
Re: [algogeeks] Amazon problem
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 till we parse the whole matrix. Now traverse the whole matrix and mark all 'Z's to 'o'. On Wed, Jun 19, 2013 at 10:56 PM, bharat b bagana.bharatku...@gmail.comwrote: sorry.. pls ignore the above post.. that doesn't work.. On Wed, Jun 19, 2013 at 10:5 5 PM, bharat b bagana.bharatku...@gmail.com 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'; } } On Mon, Jun 10, 2013 at 8:38 PM, Jai Shri Ram del7...@gmail.com wrote: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region . For example, X X X X X O O X X X O X X O X X After running your function, the board should be: X X X X X X X X X X X X X O X X -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
[algogeeks] Amazon problem
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region . For example, X X X X X O O X X X O X X O X X After running your function, the board should be: X X X X X X X X X X X X X O X X -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.
[algogeeks] Amazon Problem
In our website, people enter addresses. Each address is made up of some lines. And each address can be represented as rows in a database. how would you design a system which would verify if the addresses are valid or not, that is if the address really exists or not. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.