Add build script for Go and update Go codes.

This commit is contained in:
krahets
2023-02-09 04:45:06 +08:00
parent 12c085a088
commit e8c78f89f0
39 changed files with 391 additions and 1468 deletions

View File

@ -37,16 +37,7 @@ comments: true
=== "Go"
```go title="hashing_search.go"
/* 哈希查找(数组) */
func hashingSearchArray(m map[int]int, target int) int {
// 哈希表的 key: 目标元素value: 索引
// 若哈希表中无此 key ,返回 -1
if index, ok := m[target]; ok {
return index
} else {
return -1
}
}
[class]{}-[func]{hashingSearchArray}
```
=== "JavaScript"
@ -110,16 +101,7 @@ comments: true
=== "Go"
```go title="hashing_search.go"
/* 哈希查找(链表) */
func hashingSearchLinkedList(m map[int]*ListNode, target int) *ListNode {
// 哈希表的 key: 目标结点值value: 结点对象
// 若哈希表中无此 key ,返回 nil
if node, ok := m[target]; ok {
return node
} else {
return nil
}
}
[class]{}-[func]{hashingSearchLinkedList}
```
=== "JavaScript"