mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-08 08:51:42 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>我们有 <code>n</code> 种不同的贴纸。每个贴纸上都有一个小写的英文单词。</p>\n\n<p>您想要拼写出给定的字符串 <code>target</code> ,方法是从收集的贴纸中切割单个字母并重新排列它们。如果你愿意,你可以多次使用每个贴纸,每个贴纸的数量是无限的。</p>\n\n<p>返回你需要拼出 <code>target</code> 的最小贴纸数量。如果任务不可能,则返回 <code>-1</code> 。</p>\n\n<p><strong>注意:</strong>在所有的测试用例中,所有的单词都是从 <code>1000</code> 个最常见的美国英语单词中随机选择的,并且 <code>target</code> 被选择为两个随机单词的连接。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> stickers = [\"with\",\"example\",\"science\"], target = \"thehat\"\n<b>输出:</b>3\n<strong>解释:\n</strong>我们可以使用 2 个 \"with\" 贴纸,和 1 个 \"example\" 贴纸。\n把贴纸上的字母剪下来并重新排列后,就可以形成目标 “thehat“ 了。\n此外,这是形成目标字符串所需的最小贴纸数量。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>stickers = [\"notice\",\"possible\"], target = \"basicbasic\"\n<b>输出:</b>-1\n<strong>解释:</strong>我们不能通过剪切给定贴纸的字母来形成目标“basicbasic”。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == stickers.length</code></li>\n\t<li><code>1 <= n <= 50</code></li>\n\t<li><code>1 <= stickers[i].length <= 10</code></li>\n\t<li><code>1 <= target <= 15</code></li>\n\t<li><code>stickers[i]</code> 和 <code>target</code> 由小写英文单词组成</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 116,
|
||||
"likes": 117,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Ransom Note\", \"titleSlug\": \"ransom-note\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u8d4e\\u91d1\\u4fe1\"}]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 4962, \"totalSubmissionRaw\": 10384, \"acRate\": \"47.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"11.2K\", \"totalAcceptedRaw\": 5282, \"totalSubmissionRaw\": 11196, \"acRate\": \"47.2%\"}",
|
||||
"hints": [
|
||||
"We want to perform an exhaustive search, but we need to speed it up based on the input data being random. \r\n\r\nFor all stickers, we can ignore any letters that are not in the target word. \r\n\r\nWhen our candidate answer won't be smaller than an answer we have already found, we can stop searching this path. \r\n\r\nWhen a sticker dominates another, we shouldn't include the dominated sticker in our sticker collection. [Here, we say a sticker `A` dominates `B` if `A.count(letter) >= B.count(letter)` for all letters.]"
|
||||
],
|
||||
|
Reference in New Issue
Block a user