mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-07 01:44:56 +08:00
optimization code level from A to A+
This commit is contained in:
@ -12,10 +12,10 @@ func findWords(board [][]byte, words []string) []string {
|
||||
|
||||
// these is 79 solution
|
||||
var dir = [][]int{
|
||||
[]int{-1, 0},
|
||||
[]int{0, 1},
|
||||
[]int{1, 0},
|
||||
[]int{0, -1},
|
||||
{-1, 0},
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
{0, -1},
|
||||
}
|
||||
|
||||
func exist(board [][]byte, word string) bool {
|
||||
|
@ -27,21 +27,21 @@ func Test_Problem212(t *testing.T) {
|
||||
|
||||
qs := []question212{
|
||||
|
||||
question212{
|
||||
{
|
||||
para212{[][]byte{
|
||||
[]byte{'A', 'B', 'C', 'E'},
|
||||
[]byte{'S', 'F', 'C', 'S'},
|
||||
[]byte{'A', 'D', 'E', 'E'},
|
||||
{'A', 'B', 'C', 'E'},
|
||||
{'S', 'F', 'C', 'S'},
|
||||
{'A', 'D', 'E', 'E'},
|
||||
}, []string{"ABCCED", "SEE", "ABCB"}},
|
||||
ans212{[]string{"ABCCED", "SEE"}},
|
||||
},
|
||||
|
||||
question212{
|
||||
{
|
||||
para212{[][]byte{
|
||||
[]byte{'o', 'a', 'a', 'n'},
|
||||
[]byte{'e', 't', 'a', 'e'},
|
||||
[]byte{'i', 'h', 'k', 'r'},
|
||||
[]byte{'i', 'f', 'l', 'v'},
|
||||
{'o', 'a', 'a', 'n'},
|
||||
{'e', 't', 'a', 'e'},
|
||||
{'i', 'h', 'k', 'r'},
|
||||
{'i', 'f', 'l', 'v'},
|
||||
}, []string{"oath", "pea", "eat", "rain"}},
|
||||
ans212{[]string{"oath", "eat"}},
|
||||
},
|
||||
|
Reference in New Issue
Block a user