1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 21:46:46 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>请你设计一个用于存储字符串计数的数据结构,并能够返回计数最小和最大的字符串。</p>\n\n<p>实现 <code>AllOne</code> 类:</p>\n\n<ul>\n\t<li><code>AllOne()</code> 初始化数据结构的对象。</li>\n\t<li><code>inc(String key)</code> 字符串 <code>key</code> 的计数增加 <code>1</code> 。如果数据结构中尚不存在 <code>key</code> ,那么插入计数为 <code>1</code> 的 <code>key</code> 。</li>\n\t<li><code>dec(String key)</code> 字符串 <code>key</code> 的计数减少 <code>1</code> 。如果 <code>key</code> 的计数在减少后为 <code>0</code> ,那么需要将这个 <code>key</code> 从数据结构中删除。测试用例保证:在减少计数前,<code>key</code> 存在于数据结构中。</li>\n\t<li><code>getMaxKey()</code> 返回任意一个计数最大的字符串。如果没有元素存在,返回一个空字符串 <code>\"\"</code> 。</li>\n\t<li><code>getMinKey()</code> 返回任意一个计数最小的字符串。如果没有元素存在,返回一个空字符串 <code>\"\"</code> 。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\n[\"AllOne\", \"inc\", \"inc\", \"getMaxKey\", \"getMinKey\", \"inc\", \"getMaxKey\", \"getMinKey\"]\n[[], [\"hello\"], [\"hello\"], [], [], [\"leet\"], [], []]\n<strong>输出</strong>\n[null, null, null, \"hello\", \"hello\", null, \"hello\", \"leet\"]\n\n<strong>解释</strong>\nAllOne allOne = new AllOne();\nallOne.inc(\"hello\");\nallOne.inc(\"hello\");\nallOne.getMaxKey(); // 返回 \"hello\"\nallOne.getMinKey(); // 返回 \"hello\"\nallOne.inc(\"leet\");\nallOne.getMaxKey(); // 返回 \"hello\"\nallOne.getMinKey(); // 返回 \"leet\"\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= key.length &lt;= 10</code></li>\n\t<li><code>key</code> 由小写英文字母组成</li>\n\t<li>测试用例保证:在每次调用 <code>dec</code> 时,数据结构中总存在 <code>key</code></li>\n\t<li>最多调用 <code>inc</code>、<code>dec</code>、<code>getMaxKey</code> 和 <code>getMinKey</code> 方法 <code>5 * 10<sup>4</sup></code> 次</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 258,
"likes": 259,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"25.3K\", \"totalSubmission\": \"53.5K\", \"totalAcceptedRaw\": 25254, \"totalSubmissionRaw\": 53525, \"acRate\": \"47.2%\"}",
"stats": "{\"totalAccepted\": \"25.3K\", \"totalSubmission\": \"53.6K\", \"totalAcceptedRaw\": 25305, \"totalSubmissionRaw\": 53602, \"acRate\": \"47.2%\"}",
"hints": [],
"solution": null,
"status": null,