Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
給予一個用'1'(陸地)和'0'(水)組成的2d的網格地圖,計算有多少島嶼。一個島嶼被水所圍繞並由垂直或水平鄰近的陸地所組成。你可以假設網格中的四個邊界都被水給包圍。
LeetCode C++