0
Python
Write a function count_islands(grid) that takes a 2D list representing a map of '1's (land) and '0's (water) and returns the number of distinct islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically (not diagonally). Use recursion (DFS) for the solution.
3 Answers
+ 5
Go ahead, complete the task, we're here to help.
Btw, it's required to post specific and relevant questions in Discuss section, and it's the most observed section. So check these threads out for info:
https://www.sololearn.com/Discuss/1316935/?ref=app
https://www.sololearn.com/Discuss/333866/?ref=app
https://www.sololearn.com/Discuss/3021159/?ref=app
+ 4
Is this a test?
Ready made codes are not available in the forums. This is a popular coding challenge so post your attempt and others may try to help you đ
+ 2
Yes, write it.
If you face any problems or need help about what you need to do, tell us with your code and we'll help.