master
ZGGSONG 2 years ago
parent d35ee31f13
commit 107ddd881d

@ -1,15 +1,12 @@
package main package main
import "fmt"
/** /**
0 0 0 0
*/ */
func main() {
}
//type ListNode
/** /**
* Definition for singly-linked list. * Definition for singly-linked list.
@ -18,6 +15,23 @@ func main() {
* Next *ListNode * Next *ListNode
* } * }
*/ */
//func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode { type ListNode struct {
// return nil Val int
//} Next *ListNode
}
func main() {
l1 := new(ListNode)
l2 := new(ListNode)
l1.Val = 0
l2.Val = 2
fmt.Println(addTwoNumbers(l1, l2))
}
func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
fmt.Printf("l1Val: %v\n", l1.Val)
fmt.Printf("l2Val: %v\n", l2.Val)
return nil
}

@ -0,0 +1,3 @@
module gostudy
go 1.17

@ -0,0 +1,5 @@
package main
func main() {
}

@ -0,0 +1,23 @@
package main
import (
"fmt"
"strings"
)
func main() {
words := "how do you do !"
splits := strings.Split(words, " ")
dictWords := make(map[string]int, 10)
for _, v := range splits {
_, ok := dictWords[v]
if !ok {
dictWords[v] = 1
} else {
dictWords[v]++
}
}
for k, v := range dictWords {
fmt.Printf("%v:%v\n", k, v)
}
}
Loading…
Cancel
Save