Skip to content

Commit

Permalink
Fix goreport bug
Browse files Browse the repository at this point in the history
  • Loading branch information
halfrost committed Sep 10, 2022
1 parent dff1d84 commit a655d95
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Node struct {
Next *Node
}

//解法一:迭代
// 解法一:迭代
func connect(root *Node) *Node {
if root == nil {
return root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ans116 struct {
one *Node
}

func newQuestionNode()*Node{
func newQuestionNode() *Node {
node7 := &Node{}
node7.Val = 7

Expand Down Expand Up @@ -55,7 +55,7 @@ func newQuestionNode()*Node{
return node1
}

func newResultNode()*Node{
func newResultNode() *Node {
node7 := &Node{}
node7.Val = 7

Expand Down Expand Up @@ -114,4 +114,4 @@ func Test_Problem116(t *testing.T) {
fmt.Printf("【output】:%v \n", connect(p.one))
}
fmt.Printf("\n\n\n")
}
}
2 changes: 1 addition & 1 deletion leetcode/0306.Additive-Number/306. Additive Number.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func max(a int, b int) int {
return b
}

//Propagate for rest of the string
// Propagate for rest of the string
func recursiveCheck(num string, x1 int, x2 int, left int) bool {
if left == len(num) {
return true
Expand Down
7 changes: 4 additions & 3 deletions leetcode/0372.Super-Pow/372. Super Pow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ package leetcode
// 模运算性质五:ab % p = ((a % p) * ( b % p)) % p, 其中 ab 是一个数字,如:2874,98374 等等
// 举个例子
// 12345^678 % 1337 = (12345^670 * 12345^8) % 1337
// = ((12345^670 % 1337) * (12345^8 % 1337)) % 1337 ---> 利用性质 三
//
// = ((12345^670 % 1337) * (12345^8 % 1337)) % 1337 ---> 利用性质 三
// = (((12345^67)^10 % 1337) * (12345^8 % 1337)) % 1337 ---> 乘方性质
// = ((12345^67 % 1337)^10) % 1337 * (12345^8 % 1337)) % 1337 ---> 利用性质 四
// = (((12345^67 % 1337)^10) * (12345^8 % 1337)) % 1337 ---> 反向利用性质 三
// = ((12345^67 % 1337)^10) % 1337 * (12345^8 % 1337)) % 1337 ---> 利用性质 四
// = (((12345^67 % 1337)^10) * (12345^8 % 1337)) % 1337 ---> 反向利用性质 三
func superPow(a int, b []int) int {
res := 1
for i := 0; i < len(b); i++ {
Expand Down
10 changes: 5 additions & 5 deletions leetcode/0401.Binary-Watch/401. Binary Watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ func readBinaryWatch1(num int) []string {
return res
}

/// ---------------------------------------
/// ---------------------------------------
/// ---------------------------------------
/// ---------------------------------------
/// ---------------------------------------
// / ---------------------------------------
// / ---------------------------------------
// / ---------------------------------------
// / ---------------------------------------
// / ---------------------------------------
// 以下是打表用到的函数
// 调用 findReadBinaryWatchMinute(num, 0, c, &res) 打表
func findReadBinaryWatchMinute(target, index int, c []int, res *[]string) {
Expand Down
28 changes: 14 additions & 14 deletions leetcode/0509.Fibonacci-Number/509. Fibonacci Number.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ func fib5(N int) int {

// 解法七 协程版,但是时间特别慢,不推荐,放在这里只是告诉大家,写 LeetCode 算法题的时候,启动 goroutine 特别慢
func fib6(N int) int {
return <-fibb(N)
return <-fibb(N)
}

func fibb(n int) <- chan int {
result := make(chan int)
go func() {
defer close(result)
if n <= 1 {
result <- n
return
}
result <- <-fibb(n-1) + <-fibb(n-2)
}()
return result
}
func fibb(n int) <-chan int {
result := make(chan int)
go func() {
defer close(result)

if n <= 1 {
result <- n
return
}
result <- <-fibb(n-1) + <-fibb(n-2)
}()
return result
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package leetcode

// Definition for a Node.
// Definition for a Node.
type Node struct {
Val int
Children []*Node
Expand Down
2 changes: 1 addition & 1 deletion leetcode/0648.Replace-Words/648. Replace Words.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func findWord(roots map[byte][]string, word []byte) bool {
return false
}

//解法二 Trie
// 解法二 Trie
func replaceWords1(dict []string, sentence string) string {
trie := Constructor208()
for _, v := range dict {
Expand Down

0 comments on commit a655d95

Please sign in to comment.