1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 13:36:46 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>请你设计一个迭代器类&nbsp;<code>CombinationIterator</code>&nbsp;,包括以下内容:</p>\n\n<ul>\n\t<li><code>CombinationIterator(string characters, int combinationLength)</code>&nbsp;一个构造函数,输入参数包括:用一个&nbsp;<strong>有序且字符唯一&nbsp;</strong>的字符串&nbsp;<code>characters</code>(该字符串只包含小写英文字母)和一个数字&nbsp;<code>combinationLength</code>&nbsp;。</li>\n\t<li>函数&nbsp;<em><code>next()</code>&nbsp;</em>,按&nbsp;<strong>字典序&nbsp;</strong>返回长度为&nbsp;<code>combinationLength</code> 的下一个字母组合。</li>\n\t<li>函数&nbsp;<em><code>hasNext()</code>&nbsp;</em>,只有存在长度为&nbsp;<code>combinationLength</code> 的下一个字母组合时,才返回&nbsp;<code>true</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>\n[\"CombinationIterator\", \"next\", \"hasNext\", \"next\", \"hasNext\", \"next\", \"hasNext\"]\n[[\"abc\", 2], [], [], [], [], [], []]\n<strong>输出:</strong>\n[null, \"ab\", true, \"ac\", true, \"bc\", false]\n<strong>解释:\n</strong>CombinationIterator iterator = new CombinationIterator(\"abc\", 2); // 创建迭代器 iterator\niterator.next(); // 返回 \"ab\"\niterator.hasNext(); // 返回 true\niterator.next(); // 返回 \"ac\"\niterator.hasNext(); // 返回 true\niterator.next(); // 返回 \"bc\"\niterator.hasNext(); // 返回 false\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= combinationLength &lt;=&nbsp;characters.length &lt;= 15</code></li>\n\t<li>&nbsp;<code>characters</code>&nbsp;中每个字符都 <strong>不同</strong></li>\n\t<li>每组测试数据最多对&nbsp;<code>next</code>&nbsp;和&nbsp;<code>hasNext</code>&nbsp;调用&nbsp;<code>10<sup>4</sup></code>次</li>\n\t<li>题目保证每次调用函数&nbsp;<code>next</code>&nbsp;时都存在下一个字母组合。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 52,
"likes": 55,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.5K\", \"totalSubmission\": \"8.5K\", \"totalAcceptedRaw\": 5501, \"totalSubmissionRaw\": 8451, \"acRate\": \"65.1%\"}",
"stats": "{\"totalAccepted\": \"5.6K\", \"totalSubmission\": \"8.6K\", \"totalAcceptedRaw\": 5588, \"totalSubmissionRaw\": 8570, \"acRate\": \"65.2%\"}",
"hints": [
"Generate all combinations as a preprocessing.",
"Use bit masking to generate all the combinations."