Nothing special, I used two method to do it, BFS and DFS. first I used a loop to traverse the map, and when we meet the 1, we go to the map and set all the connection as 0.
Error:
In BFS, I use the x, y to update new_x, new_y. Actually I need to use the element of the front queue, that is the reason of the onsite.