mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 23:41:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>你有 <code>n</code> 道不同菜的信息。给你一个字符串数组 <code>recipes</code> 和一个二维字符串数组 <code>ingredients</code> 。第 <code>i</code> 道菜的名字为 <code>recipes[i]</code> ,如果你有它 <strong>所有</strong> 的原材料 <code>ingredients[i]</code> ,那么你可以 <strong>做出</strong> 这道菜。一道菜的原材料可能是 <strong>另一道</strong> 菜,也就是说 <code>ingredients[i]</code> 可能包含 <code>recipes</code> 中另一个字符串。</p>\n\n<p>同时给你一个字符串数组 <code>supplies</code> ,它包含你初始时拥有的所有原材料,每一种原材料你都有无限多。</p>\n\n<p>请你返回你可以做出的所有菜。你可以以 <strong>任意顺序</strong> 返回它们。</p>\n\n<p>注意两道菜在它们的原材料中可能互相包含。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><b>输入:</b>recipes = [\"bread\"], ingredients = [[\"yeast\",\"flour\"]], supplies = [\"yeast\",\"flour\",\"corn\"]\n<b>输出:</b>[\"bread\"]\n<strong>解释:</strong>\n我们可以做出 \"bread\" ,因为我们有原材料 \"yeast\" 和 \"flour\" 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><b>输入:</b>recipes = [\"bread\",\"sandwich\"], ingredients = [[\"yeast\",\"flour\"],[\"bread\",\"meat\"]], supplies = [\"yeast\",\"flour\",\"meat\"]\n<b>输出:</b>[\"bread\",\"sandwich\"]\n<strong>解释:</strong>\n我们可以做出 \"bread\" ,因为我们有原材料 \"yeast\" 和 \"flour\" 。\n我们可以做出 \"sandwich\" ,因为我们有原材料 \"meat\" 且可以做出原材料 \"bread\" 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><b>输入:</b>recipes = [\"bread\",\"sandwich\",\"burger\"], ingredients = [[\"yeast\",\"flour\"],[\"bread\",\"meat\"],[\"sandwich\",\"meat\",\"bread\"]], supplies = [\"yeast\",\"flour\",\"meat\"]\n<b>输出:</b>[\"bread\",\"sandwich\",\"burger\"]\n<strong>解释:</strong>\n我们可以做出 \"bread\" ,因为我们有原材料 \"yeast\" 和 \"flour\" 。\n我们可以做出 \"sandwich\" ,因为我们有原材料 \"meat\" 且可以做出原材料 \"bread\" 。\n我们可以做出 \"burger\" ,因为我们有原材料 \"meat\" 且可以做出原材料 \"bread\" 和 \"sandwich\" 。\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre><b>输入:</b>recipes = [\"bread\"], ingredients = [[\"yeast\",\"flour\"]], supplies = [\"yeast\"]\n<b>输出:</b>[]\n<strong>解释:</strong>\n我们没法做出任何菜,因为我们只有原材料 \"yeast\" 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == recipes.length == ingredients.length</code></li>\n\t<li><code>1 <= n <= 100</code></li>\n\t<li><code>1 <= ingredients[i].length, supplies.length <= 100</code></li>\n\t<li><code>1 <= recipes[i].length, ingredients[i][j].length, supplies[k].length <= 10</code></li>\n\t<li><code>recipes[i], ingredients[i][j]</code> 和 <code>supplies[k]</code> 只包含小写英文字母。</li>\n\t<li>所有 <code>recipes</code> 和 <code>supplies</code> 中的值互不相同。</li>\n\t<li><code>ingredients[i]</code> 中的字符串互不相同。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 19,
|
||||
"likes": 21,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.8K\", \"totalSubmission\": \"10.1K\", \"totalAcceptedRaw\": 3807, \"totalSubmissionRaw\": 10064, \"acRate\": \"37.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4K\", \"totalSubmission\": \"10.5K\", \"totalAcceptedRaw\": 4036, \"totalSubmissionRaw\": 10513, \"acRate\": \"38.4%\"}",
|
||||
"hints": [
|
||||
"Can we use a data structure to quickly query whether we have a certain ingredient?",
|
||||
"Once we verify that we can make a recipe, we can add it to our ingredient data structure. We can then check if we can make more recipes as a result of this."
|
||||
|
Reference in New Issue
Block a user