optimization code level from A to A+

This commit is contained in:
YDZ
2020-08-26 23:43:03 +08:00
parent 7b7307761c
commit 96c36de45b
519 changed files with 2341 additions and 2322 deletions

View File

@ -1,14 +1,14 @@
package leetcode
var dir8 = [][]int{
[]int{-1, -1},
[]int{-1, 0},
[]int{-1, 1},
[]int{0, 1},
[]int{1, 1},
[]int{1, 0},
[]int{1, -1},
[]int{0, -1},
{-1, -1},
{-1, 0},
{-1, 1},
{0, 1},
{1, 1},
{1, 0},
{1, -1},
{0, -1},
}
func updateBoard(board [][]byte, click []int) [][]byte {

View File

@ -27,33 +27,33 @@ func Test_Problem529(t *testing.T) {
qs := []question529{
question529{
{
para529{[][]byte{
[]byte{'E', 'E', 'E', 'E', 'E'},
[]byte{'E', 'E', 'M', 'E', 'E'},
[]byte{'E', 'E', 'E', 'E', 'E'},
[]byte{'E', 'E', 'E', 'E', 'E'},
{'E', 'E', 'E', 'E', 'E'},
{'E', 'E', 'M', 'E', 'E'},
{'E', 'E', 'E', 'E', 'E'},
{'E', 'E', 'E', 'E', 'E'},
}, []int{3, 0}},
ans529{[][]byte{
[]byte{'B', '1', 'E', '1', 'B'},
[]byte{'B', '1', 'M', '1', 'B'},
[]byte{'B', '1', '1', '1', 'B'},
[]byte{'B', 'B', 'B', 'B', 'B'},
{'B', '1', 'E', '1', 'B'},
{'B', '1', 'M', '1', 'B'},
{'B', '1', '1', '1', 'B'},
{'B', 'B', 'B', 'B', 'B'},
}},
},
question529{
{
para529{[][]byte{
[]byte{'B', '1', 'E', '1', 'B'},
[]byte{'B', '1', 'M', '1', 'B'},
[]byte{'B', '1', '1', '1', 'B'},
[]byte{'B', 'B', 'B', 'B', 'B'},
{'B', '1', 'E', '1', 'B'},
{'B', '1', 'M', '1', 'B'},
{'B', '1', '1', '1', 'B'},
{'B', 'B', 'B', 'B', 'B'},
}, []int{1, 2}},
ans529{[][]byte{
[]byte{'B', '1', 'E', '1', 'B'},
[]byte{'B', '1', 'X', '1', 'B'},
[]byte{'B', '1', '1', '1', 'B'},
[]byte{'B', 'B', 'B', 'B', 'B'},
{'B', '1', 'E', '1', 'B'},
{'B', '1', 'X', '1', 'B'},
{'B', '1', '1', '1', 'B'},
{'B', 'B', 'B', 'B', 'B'},
}},
},
}