mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-24 10:37:33 +08:00
Merge pull request #60 from halfrost/code_quality_improvement
optimization code quality level from A to A+
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
package leetcode
|
||||
|
||||
var dir = [][]int{
|
||||
[]int{-1, 0},
|
||||
[]int{0, 1},
|
||||
[]int{1, 0},
|
||||
[]int{0, -1},
|
||||
{-1, 0},
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
{0, -1},
|
||||
}
|
||||
|
||||
func uniquePathsIII(grid [][]int) int {
|
||||
@ -53,7 +53,7 @@ func findUniquePathIII(board [][]int, visited [][]bool, path []int, empty, start
|
||||
}
|
||||
}
|
||||
visited[startx][starty] = false
|
||||
empty++
|
||||
//empty++ 这里虽然可以还原这个变量值,但是赋值没有意义,干脆不写了
|
||||
path = path[:len(path)-2]
|
||||
}
|
||||
return
|
||||
|
@ -26,28 +26,28 @@ func Test_Problem980(t *testing.T) {
|
||||
|
||||
qs := []question980{
|
||||
|
||||
question980{
|
||||
{
|
||||
para980{[][]int{
|
||||
[]int{1, 0, 0, 0},
|
||||
[]int{0, 0, 0, 0},
|
||||
[]int{0, 0, 2, -1},
|
||||
{1, 0, 0, 0},
|
||||
{0, 0, 0, 0},
|
||||
{0, 0, 2, -1},
|
||||
}},
|
||||
ans980{2},
|
||||
},
|
||||
|
||||
question980{
|
||||
{
|
||||
para980{[][]int{
|
||||
[]int{1, 0, 0, 0},
|
||||
[]int{0, 0, 0, 0},
|
||||
[]int{0, 0, 0, 2},
|
||||
{1, 0, 0, 0},
|
||||
{0, 0, 0, 0},
|
||||
{0, 0, 0, 2},
|
||||
}},
|
||||
ans980{4},
|
||||
},
|
||||
|
||||
question980{
|
||||
{
|
||||
para980{[][]int{
|
||||
[]int{1, 0},
|
||||
[]int{0, 2},
|
||||
{1, 0},
|
||||
{0, 2},
|
||||
}},
|
||||
ans980{0},
|
||||
},
|
||||
|
Reference in New Issue
Block a user