mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-24 14:28:56 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>电子游戏“辐射4”中,任务 <strong>“通向自由”</strong> 要求玩家到达名为 “<strong>Freedom Trail Ring”</strong> 的金属表盘,并使用表盘拼写特定关键词才能开门。</p>\n\n<p>给定一个字符串 <code>ring</code> ,表示刻在外环上的编码;给定另一个字符串 <code>key</code> ,表示需要拼写的关键词。您需要算出能够拼写关键词中所有字符的<strong>最少</strong>步数。</p>\n\n<p>最初,<strong>ring </strong>的第一个字符与 <code>12:00</code> 方向对齐。您需要顺时针或逆时针旋转 <code>ring</code> 以使 <strong>key </strong>的一个字符在 <code>12:00</code> 方向对齐,然后按下中心按钮,以此逐个拼写完 <strong><code>key</code> </strong>中的所有字符。</p>\n\n<p>旋转 <code>ring</code><strong> </strong>拼出 key 字符 <code>key[i]</code><strong> </strong>的阶段中:</p>\n\n<ol>\n\t<li>您可以将 <strong>ring </strong>顺时针或逆时针旋转 <strong>一个位置 </strong>,计为1步。旋转的最终目的是将字符串 <strong><code>ring</code> </strong>的一个字符与 <code>12:00</code> 方向对齐,并且这个字符必须等于字符 <strong><code>key[i]</code> 。</strong></li>\n\t<li>如果字符 <strong><code>key[i]</code> </strong>已经对齐到12:00方向,您需要按下中心按钮进行拼写,这也将算作 <strong>1 步</strong>。按完之后,您可以开始拼写 <strong>key </strong>的下一个字符(下一阶段), 直至完成所有拼写。</li>\n</ol>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2018/10/22/ring.jpg\" style=\"height: 450px; width: 450px;\" /></p>\n\n<center> </center>\n\n<pre>\n<strong>输入:</strong> ring = \"godding\", key = \"gd\"\n<strong>输出:</strong> 4\n<strong>解释:</strong>\n 对于 key 的第一个字符 'g',已经在正确的位置, 我们只需要1步来拼写这个字符。 \n 对于 key 的第二个字符 'd',我们需要逆时针旋转 ring \"godding\" 2步使它变成 \"ddinggo\"。\n 当然, 我们还需要1步进行拼写。\n 因此最终的输出是 4。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> ring = \"godding\", key = \"godding\"\n<strong>输出:</strong> 13\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= ring.length, key.length <= 100</code></li>\n\t<li><code>ring</code> 和 <code>key</code> 只包含小写英文字母</li>\n\t<li><strong>保证</strong> 字符串 <code>key</code> 一定可以由字符串 <code>ring</code> 旋转拼出</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 230,
|
||||
"likes": 231,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"21.5K\", \"totalSubmission\": \"43K\", \"totalAcceptedRaw\": 21548, \"totalSubmissionRaw\": 43013, \"acRate\": \"50.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"21.6K\", \"totalSubmission\": \"43.1K\", \"totalAcceptedRaw\": 21583, \"totalSubmissionRaw\": 43095, \"acRate\": \"50.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
||||
Reference in New Issue
Block a user