1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 23:41:41 +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>你有 <code>n</code>&nbsp;道不同菜的信息。给你一个字符串数组&nbsp;<code>recipes</code>&nbsp;和一个二维字符串数组&nbsp;<code>ingredients</code>&nbsp;。第&nbsp;<code>i</code>&nbsp;道菜的名字为&nbsp;<code>recipes[i]</code>&nbsp;,如果你有它&nbsp;<strong>所有</strong>&nbsp;的原材料&nbsp;<code>ingredients[i]</code>&nbsp;,那么你可以&nbsp;<strong>做出</strong>&nbsp;这道菜。一道菜的原材料可能是&nbsp;<strong>另一道</strong>&nbsp;菜,也就是说&nbsp;<code>ingredients[i]</code>&nbsp;可能包含&nbsp;<code>recipes</code>&nbsp;中另一个字符串。</p>\n\n<p>同时给你一个字符串数组&nbsp;<code>supplies</code>&nbsp;,它包含你初始时拥有的所有原材料,每一种原材料你都有无限多。</p>\n\n<p>请你返回你可以做出的所有菜。你可以以 <strong>任意顺序</strong>&nbsp;返回它们。</p>\n\n<p>注意两道菜在它们的原材料中可能互相包含。</p>\n\n<p>&nbsp;</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>&nbsp;</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 &lt;= n &lt;= 100</code></li>\n\t<li><code>1 &lt;= ingredients[i].length, supplies.length &lt;= 100</code></li>\n\t<li><code>1 &lt;= recipes[i].length, ingredients[i][j].length, supplies[k].length &lt;= 10</code></li>\n\t<li><code>recipes[i], ingredients[i][j]</code>&nbsp;和&nbsp;<code>supplies[k]</code>&nbsp;只包含小写英文字母。</li>\n\t<li>所有&nbsp;<code>recipes</code> 和&nbsp;<code>supplies</code>&nbsp;中的值互不相同。</li>\n\t<li><code>ingredients[i]</code>&nbsp;中的字符串互不相同。</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."