Fix goreport bug

This commit is contained in:
halfrost
2022-09-10 10:38:39 -07:00
parent dff1d84e1e
commit a655d95eea
8 changed files with 30 additions and 29 deletions

View File

@ -7,7 +7,7 @@ type Node struct {
Next *Node
}
//解法一:迭代
// 解法一:迭代
func connect(root *Node) *Node {
if root == nil {
return root

View File

@ -22,7 +22,7 @@ type ans116 struct {
one *Node
}
func newQuestionNode()*Node{
func newQuestionNode() *Node {
node7 := &Node{}
node7.Val = 7
@ -55,7 +55,7 @@ func newQuestionNode()*Node{
return node1
}
func newResultNode()*Node{
func newResultNode() *Node {
node7 := &Node{}
node7.Val = 7

View File

@ -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

View File

@ -8,10 +8,11 @@ package leetcode
// 模运算性质五ab % p = ((a % p) * ( b % p)) % p, 其中 ab 是一个数字,如:287498374 等等
// 举个例子
// 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++ {

View File

@ -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) {

View File

@ -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)
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
if n <= 1 {
result <- n
return
}
result <- <-fibb(n-1) + <-fibb(n-2)
}()
return result
}

View File

@ -1,6 +1,6 @@
package leetcode
// Definition for a Node.
// Definition for a Node.
type Node struct {
Val int
Children []*Node

View File

@ -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 {