Flood Fill
Definition
void ff(int x, int y){
if(x < 0 || x >= n || y < 0 || y >= m || arr[x][y] != 1)
return ;
arr[x][y] = 2;
ff(x+1, y);
ff(x-1, y);
ff(x, y+1);
ff(x, y-1);
}Last updated
void ff(int x, int y){
if(x < 0 || x >= n || y < 0 || y >= m || arr[x][y] != 1)
return ;
arr[x][y] = 2;
ff(x+1, y);
ff(x-1, y);
ff(x, y+1);
ff(x, y-1);
}Last updated