mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-30 03:47:14 +00:00
Fix Repo
This commit is contained in:
@@ -25,14 +25,7 @@ comments: true
|
||||
=== "C++"
|
||||
|
||||
```cpp title="hashing_search.cpp"
|
||||
/* 哈希查找(数组) */
|
||||
int hashingSearchArray(unordered_map<int, int> map, int target) {
|
||||
// 哈希表的 key: 目标元素,value: 索引
|
||||
// 若哈希表中无此 key ,返回 -1
|
||||
if (map.find(target) == map.end())
|
||||
return -1;
|
||||
return map[target];
|
||||
}
|
||||
[class]{}-[func]{hashingSearchArray}
|
||||
```
|
||||
|
||||
=== "Python"
|
||||
@@ -126,14 +119,7 @@ comments: true
|
||||
=== "C++"
|
||||
|
||||
```cpp title="hashing_search.cpp"
|
||||
/* 哈希查找(链表) */
|
||||
ListNode* hashingSearchLinkedList(unordered_map<int, ListNode*> map, int target) {
|
||||
// 哈希表的 key: 目标结点值,value: 结点对象
|
||||
// 若哈希表中无此 key ,返回 nullptr
|
||||
if (map.find(target) == map.end())
|
||||
return nullptr;
|
||||
return map[target];
|
||||
}
|
||||
[class]{}-[func]{hashingSearchLinkedList}
|
||||
```
|
||||
|
||||
=== "Python"
|
||||
|
||||
Reference in New Issue
Block a user