## 852 - Deciding victory in Go
Difficulty : mediumSolution Description : Flood Fill problem This is a 4-way flood fill problem. Adjacency for each cell (i,j) -> cell(i,j-1), cell(i,j+1), cell(i-1,j), and cell(i+1,j) In this problem you need to run two flood fill, one for white and other for black. In flood fill for white set whiteVisited[][]=true where white can visited. Remember white does not visit any cell where the cell is block by black. In flood fill for black set blackVisited[][]=true where black can visited. Remember black does not visit any cell where the cell is block by white. After flood fill if whiteVisited[i][j]==true and blackVisited[i][j]==true then do not need to count it if whiteVisited[i][j]==true then increment the white counter if blackVisited[i][j]==true then increment the black counter At last print black counter and white counter. |
||||||||||