MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / dfs

Function dfs

go/0097-interleaving-string.go:17–37  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

15}
16
17func dfs(i, j int) bool {
18 if i >= len(st1) && j >= len(st2) {
19 return true
20 }
21
22 val, ok := cache[[2]int{i, j}]
23
24 if ok {
25 return val
26 }
27
28 if i < len(st1) && st1[i] == st3[i+j] && dfs(i+1, j) {
29 return true
30 }
31 if j < len(st2) && st2[j] == st3[i+j] && dfs(i, j+1) {
32 return true
33 }
34
35 cache[[2]int{i, j}] = false
36 return false
37}

Callers 1

isInterleaveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected