Skip to content

Commit 8f29230

Browse files
committed
feat:
1 parent a89eff8 commit 8f29230

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

algorithm/79.WordSearch/main.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
package exist
22

3+
import "strings"
4+
35
func exist(board [][]byte, word string) bool {
4-
for i,j:=0,0;
6+
c := ""
7+
for _, col := range board {
8+
for _, e := range col {
9+
c += string(e)
10+
}
11+
}
12+
for _, e := range word {
13+
ii := strings.Index(c, string(e))
14+
if ii == -1 {
15+
return false
16+
} else {
17+
c = c[:ii] + c[ii+1:]
18+
}
19+
}
520
return true
621
}

0 commit comments

Comments
 (0)