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>请你设计一个迭代器类 <code>CombinationIterator</code> ,包括以下内容:</p>\n\n<ul>\n\t<li><code>CombinationIterator(string characters, int combinationLength)</code> 一个构造函数,输入参数包括:用一个 <strong>有序且字符唯一 </strong>的字符串 <code>characters</code>(该字符串只包含小写英文字母)和一个数字 <code>combinationLength</code> 。</li>\n\t<li>函数 <em><code>next()</code> </em>,按 <strong>字典序 </strong>返回长度为 <code>combinationLength</code> 的下一个字母组合。</li>\n\t<li>函数 <em><code>hasNext()</code> </em>,只有存在长度为 <code>combinationLength</code> 的下一个字母组合时,才返回 <code>true</code></li>\n</ul>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= combinationLength <= characters.length <= 15</code></li>\n\t<li> <code>characters</code> 中每个字符都 <strong>不同</strong></li>\n\t<li>每组测试数据最多对 <code>next</code> 和 <code>hasNext</code> 调用 <code>10<sup>4</sup></code>次</li>\n\t<li>题目保证每次调用函数 <code>next</code> 时都存在下一个字母组合。</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."
|
||||
|
Reference in New Issue
Block a user