mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "你的赛车可以从位置 <code>0</code> 开始,并且速度为 <code>+1</code> ,在一条无限长的数轴上行驶。赛车也可以向负方向行驶。赛车可以按照由加速指令 <code>'A'</code> 和倒车指令 <code>'R'</code> 组成的指令序列自动行驶。\n<ul>\n\t<li>当收到指令 <code>'A'</code> 时,赛车这样行驶:\n\t<ul>\n\t\t<li><code>position += speed</code></li>\n\t\t<li><code>speed *= 2</code></li>\n\t</ul>\n\t</li>\n\t<li>当收到指令 <code>'R'</code> 时,赛车这样行驶:\n\t<ul>\n\t\t<li>如果速度为正数,那么<code>speed = -1</code></li>\n\t\t<li>否则 <code>speed = 1</code></li>\n\t</ul>\n\t当前所处位置不变。</li>\n</ul>\n\n<p>例如,在执行指令 <code>\"AAR\"</code> 后,赛车位置变化为 <code>0 --> 1 --> 3 --> 3</code> ,速度变化为 <code>1 --> 2 --> 4 --> -1</code> 。</p>\n\n<p>给你一个目标位置 <code>target</code> ,返回能到达目标位置的最短指令序列的长度。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>target = 3\n<strong>输出:</strong>2\n<strong>解释:</strong>\n最短指令序列是 \"AA\" 。\n位置变化 0 --> 1 --> 3 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>target = 6\n<strong>输出:</strong>5\n<strong>解释:</strong>\n最短指令序列是 \"AAARA\" 。\n位置变化 0 --> 1 --> 3 --> 7 --> 7 --> 6 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= target <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 120,
|
||||
"likes": 122,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.2K\", \"totalSubmission\": \"9.6K\", \"totalAcceptedRaw\": 4197, \"totalSubmissionRaw\": 9581, \"acRate\": \"43.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.3K\", \"totalSubmission\": \"9.9K\", \"totalAcceptedRaw\": 4328, \"totalSubmissionRaw\": 9879, \"acRate\": \"43.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user