Skip to content

Commit 6966f79

Browse files
committed
word_search
1 parent 1a11e16 commit 6966f79

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Golang solution for leetcode. For each problem, there is a simple *_test.go to t
6868
#### [76. minimum window substring](https://github.com/hitzzc/go-leetcode/tree/master/minimum_window_substring)
6969
#### [77. combinations](https://github.com/hitzzc/go-leetcode/tree/master/combinations)
7070
#### [78. subsets](https://github.com/hitzzc/go-leetcode/tree/master/subsets)
71+
#### [79. word search(not solved)](https://github.com/hitzzc/go-leetcode/tree/master/word_search)
7172

7273

7374

word_search/word_search.go

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package word_search
2+
3+
func exist(board [][]byte, word string) bool {
4+
words := []byte(word)
5+
if len(words) == 0 || len(board) == 0 || len(board[0]) == 0 {
6+
return true
7+
}
8+
9+
mask := make([][]bool, len(board))
10+
for i := 0; i < len(board); i++ {
11+
mask[i] = make([]int, len(board[i]))
12+
}
13+
14+
for i := 0; i < len(board); i++ {
15+
for j := 0; j < len(board[i]); j++ {
16+
17+
}
18+
}
19+
return false
20+
}
21+
22+
func getExist(board [][]byte, words []byte, index int, row int, col int, mask [][]int) {
23+
24+
}

word_search/word_search_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package word_search
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestExist(t *testing.T) {
8+
board := [][]byte{
9+
[]byte("abce"),
10+
[]byte("sfcs"),
11+
[]byte("adee"),
12+
}
13+
println(exist(board, "abceseeefs"))
14+
}

0 commit comments

Comments
 (0)