Add build script for JS and TS codes.

This commit is contained in:
krahets
2023-02-08 19:45:06 +08:00
parent 22b7d65d20
commit 05f0054005
28 changed files with 227 additions and 2217 deletions

View File

@ -52,23 +52,13 @@ comments: true
=== "JavaScript"
```javascript title="hashing_search.js"
/* 哈希查找(数组) */
function hashingSearchArray(map, target) {
// 哈希表的 key: 目标元素value: 索引
// 若哈希表中无此 key ,返回 -1
return map.has(target) ? map.get(target) : -1;
}
[class]{}-[func]{hashingSearchArray}
```
=== "TypeScript"
```typescript title="hashing_search.ts"
/* 哈希查找(数组) */
function hashingSearchArray(map: Map<number, number>, target: number): number {
// 哈希表的 key: 目标元素value: 索引
// 若哈希表中无此 key ,返回 -1
return map.has(target) ? map.get(target) as number : -1;
}
[class]{}-[func]{hashingSearchArray}
```
=== "C"
@ -146,23 +136,13 @@ comments: true
=== "JavaScript"
```javascript title="hashing_search.js"
/* 哈希查找(链表) */
function hashingSearchLinkedList(map, target) {
// 哈希表的 key: 目标结点值value: 结点对象
// 若哈希表中无此 key ,返回 null
return map.has(target) ? map.get(target) : null;
}
[class]{}-[func]{hashingSearchLinkedList}
```
=== "TypeScript"
```typescript title="hashing_search.ts"
/* 哈希查找(链表) */
function hashingSearchLinkedList(map: Map<number, ListNode>, target: number): ListNode | null {
// 哈希表的 key: 目标结点值value: 结点对象
// 若哈希表中无此 key ,返回 null
return map.has(target) ? map.get(target) as ListNode : null;
}
[class]{}-[func]{hashingSearchLinkedList}
```
=== "C"