MCPcopy Create free account
hub / github.com/VanjaRo/LeetCode / dfs

Function dfs

tasks/200.go:20–30  ·  view source on GitHub ↗
(i, j int, grid *[][]byte)

Source from the content-addressed store, hash-verified

18}
19
20func dfs(i, j int, grid *[][]byte) {
21 if i < 0 || j < 0 || i >= len((*grid)) || j >= len((*grid)[0]) || (*grid)[i][j] == byte('0') {
22 return
23 }
24
25 (*grid)[i][j] = '0'
26 dfs(i-1, j, grid)
27 dfs(i+1, j, grid)
28 dfs(i, j-1, grid)
29 dfs(i, j+1, grid)
30}

Callers 1

numIslandsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected