@@ -0,0 +1,703 @@
+class Solution:%0A    def numIslands(self, grid: 'List%5BList%5Bstr%5D%5D') -%3E 'int':%0A        lx = len(grid)%0A        if lx == 0: return 0%0A        ly = len(grid%5B0%5D)%0A        if ly == 0: return 0%0A        count = 0%0A        %0A        def dfs(x,y):%0A            grid%5Bx%5D%5By%5D = '0'%0A            if x+1 %3C lx and grid%5Bx+1%5D%5By%5D == '1': dfs(x+1,y)%0A            if x-1 %3E= 0 and grid%5Bx-1%5D%5By%5D == '1': dfs(x-1,y)%0A            if y+1 %3C ly and grid%5Bx%5D%5By+1%5D == '1': dfs(x, y+1)%0A            if y-1 %3E= 0 and grid%5Bx%5D%5By-1%5D == '1': dfs(x, y-1)%0A                %0A        for x in range(0,lx):%0A            for y in range(0,ly):%0A                if grid%5Bx%5D%5By%5D == '1':%0A                    count += 1%0A                    dfs(x,y)%0A        return count%0A

200 Number of Islands