1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-12-18 18:14:59 +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>设计一个包含一些单词的特殊词典,并能够通过前缀和后缀来检索单词。</p>\n\n<p>实现 <code>WordFilter</code> 类:</p>\n\n<ul>\n\t<li><code>WordFilter(string[] words)</code> 使用词典中的单词 <code>words</code> 初始化对象。</li>\n\t<li><code>f(string prefix, string suffix)</code> 返回词典中具有前缀 <code>prefix</code> 和后缀<code>suffix</code> 的单词的下标。如果存在不止一个满足要求的下标,返回其中 <strong>最大的下标</strong> 。如果不存在这样的单词,返回 <code>-1</code> 。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例</strong></p>\n\n<pre>\n<strong>输入:</strong>\n[\"WordFilter\", \"f\"]\n[[[\"apple\"]], [\"a\", \"e\"]]\n<strong>输出:</strong>\n[null, 0]\n\n<strong>解释:</strong>\nWordFilter wordFilter = new WordFilter([\"apple\"]);\nwordFilter.f(\"a\", \"e\"); // 返回 0 ,因为下标为 0 的单词的 prefix = \"a\" 且 suffix = 'e\" 。\n</pre>\n \n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= words.length <= 15000</code></li>\n\t<li><code>1 <= words[i].length <= 10</code></li>\n\t<li><code>1 <= prefix.length, suffix.length <= 10</code></li>\n\t<li><code>words[i]</code>、<code>prefix</code> 和 <code>suffix</code> 仅由小写英文字母组成</li>\n\t<li>最多对函数 <code>f</code> 进行 <code>15000</code> 次调用</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 84,
"likes": 86,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Design Add and Search Words Data Structure\", \"titleSlug\": \"design-add-and-search-words-data-structure\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6dfb\\u52a0\\u4e0e\\u641c\\u7d22\\u5355\\u8bcd - \\u6570\\u636e\\u7ed3\\u6784\\u8bbe\\u8ba1\"}]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"8.9K\", \"totalAcceptedRaw\": 3635, \"totalSubmissionRaw\": 8909, \"acRate\": \"40.8%\"}",
"stats": "{\"totalAccepted\": \"3.8K\", \"totalSubmission\": \"9.3K\", \"totalAcceptedRaw\": 3811, \"totalSubmissionRaw\": 9323, \"acRate\": \"40.9%\"}",
"hints": [
"For a word like \"test\", consider \"#test\", \"t#test\", \"st#test\", \"est#test\", \"test#test\". Then if we have a query like prefix = \"te\", suffix = \"t\", we can find it by searching for something we've inserted starting with \"t#te\"."
],