mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 13:36:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>不使用任何内建的哈希表库设计一个哈希映射(HashMap)。</p>\n\n<p>实现 <code>MyHashMap</code> 类:</p>\n\n<ul>\n\t<li><code>MyHashMap()</code> 用空映射初始化对象</li>\n\t<li><code>void put(int key, int value)</code> 向 HashMap 插入一个键值对 <code>(key, value)</code> 。如果 <code>key</code> 已经存在于映射中,则更新其对应的值 <code>value</code> 。</li>\n\t<li><code>int get(int key)</code> 返回特定的 <code>key</code> 所映射的 <code>value</code> ;如果映射中不包含 <code>key</code> 的映射,返回 <code>-1</code> 。</li>\n\t<li><code>void remove(key)</code> 如果映射中存在 <code>key</code> 的映射,则移除 <code>key</code> 和它所对应的 <code>value</code> 。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>:\n[\"MyHashMap\", \"put\", \"put\", \"get\", \"get\", \"put\", \"get\", \"remove\", \"get\"]\n[[], [1, 1], [2, 2], [1], [3], [2, 1], [2], [2], [2]]\n<strong>输出</strong>:\n[null, null, null, 1, -1, null, 1, null, -1]\n\n<strong>解释</strong>:\nMyHashMap myHashMap = new MyHashMap();\nmyHashMap.put(1, 1); // myHashMap 现在为 [[1,1]]\nmyHashMap.put(2, 2); // myHashMap 现在为 [[1,1], [2,2]]\nmyHashMap.get(1); // 返回 1 ,myHashMap 现在为 [[1,1], [2,2]]\nmyHashMap.get(3); // 返回 -1(未找到),myHashMap 现在为 [[1,1], [2,2]]\nmyHashMap.put(2, 1); // myHashMap 现在为 [[1,1], [2,1]](更新已有的值)\nmyHashMap.get(2); // 返回 1 ,myHashMap 现在为 [[1,1], [2,1]]\nmyHashMap.remove(2); // 删除键为 2 的数据,myHashMap 现在为 [[1,1]]\nmyHashMap.get(2); // 返回 -1(未找到),myHashMap 现在为 [[1,1]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= key, value <= 10<sup>6</sup></code></li>\n\t<li>最多调用 <code>10<sup>4</sup></code> 次 <code>put</code>、<code>get</code> 和 <code>remove</code> 方法</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 283,
|
||||
"likes": 290,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Design HashSet\", \"titleSlug\": \"design-hashset\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u8bbe\\u8ba1\\u54c8\\u5e0c\\u96c6\\u5408\"}]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"72K\", \"totalSubmission\": \"112.6K\", \"totalAcceptedRaw\": 72033, \"totalSubmissionRaw\": 112570, \"acRate\": \"64.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"74.5K\", \"totalSubmission\": \"116.6K\", \"totalAcceptedRaw\": 74525, \"totalSubmissionRaw\": 116626, \"acRate\": \"63.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user