mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-12-14 14:42:36 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>在无限的平面上,机器人最初位于 <code>(0, 0)</code> 处,面朝北方。注意:</p>\n\n<ul>\n\t<li><strong>北方向</strong> 是y轴的正方向。</li>\n\t<li><strong>南方向</strong> 是y轴的负方向。</li>\n\t<li><strong>东方向</strong> 是x轴的正方向。</li>\n\t<li><strong>西方向</strong> 是x轴的负方向。</li>\n</ul>\n\n<p>机器人可以接受下列三条指令之一:</p>\n\n<ul>\n\t<li><code>\"G\"</code>:直走 1 个单位</li>\n\t<li><code>\"L\"</code>:左转 90 度</li>\n\t<li><code>\"R\"</code>:右转 90 度</li>\n</ul>\n\n<p>机器人按顺序执行指令 <code>instructions</code>,并一直重复它们。</p>\n\n<p>只有在平面中存在环使得机器人永远无法离开时,返回 <code>true</code>。否则,返回 <code>false</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>instructions = \"GGLLGG\"\n<strong>输出:</strong>true\n<strong>解释:</strong>机器人最初在(0,0)处,面向北方。\n“G”:移动一步。位置:(0,1)方向:北。\n“G”:移动一步。位置:(0,2).方向:北。\n“L”:逆时针旋转90度。位置:(0,2).方向:西。\n“L”:逆时针旋转90度。位置:(0,2)方向:南。\n“G”:移动一步。位置:(0,1)方向:南。\n“G”:移动一步。位置:(0,0)方向:南。\n重复指令,机器人进入循环:(0,0)——>(0,1)——>(0,2)——>(0,1)——>(0,0)。\n在此基础上,我们返回true。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>instructions = \"GG\"\n<strong>输出:</strong>false\n<strong>解释:</strong>机器人最初在(0,0)处,面向北方。\n“G”:移动一步。位置:(0,1)方向:北。\n“G”:移动一步。位置:(0,2).方向:北。\n重复这些指示,继续朝北前进,不会进入循环。\n在此基础上,返回false。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>instructions = \"GL\"\n<strong>输出:</strong>true\n<strong>解释:</strong>机器人最初在(0,0)处,面向北方。\n“G”:移动一步。位置:(0,1)方向:北。\n“L”:逆时针旋转90度。位置:(0,1).方向:西。\n“G”:移动一步。位置:(- 1,1)方向:西。\n“L”:逆时针旋转90度。位置:(- 1,1)方向:南。\n“G”:移动一步。位置:(- 1,0)方向:南。\n“L”:逆时针旋转90度。位置:(- 1,0)方向:东方。\n“G”:移动一步。位置:(0,0)方向:东方。\n“L”:逆时针旋转90度。位置:(0,0)方向:北。\n重复指令,机器人进入循环:(0,0)——>(0,1)——>(- 1,1)——>(- 1,0)——>(0,0)。\n在此基础上,我们返回true。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= instructions.length <= 100</code></li>\n\t<li><code>instructions[i]</code> 仅包含 <code>'G', 'L', 'R'</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 112,
|
||||
"likes": 113,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.4K\", \"totalSubmission\": \"17K\", \"totalAcceptedRaw\": 8416, \"totalSubmissionRaw\": 17009, \"acRate\": \"49.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"17.5K\", \"totalAcceptedRaw\": 8677, \"totalSubmissionRaw\": 17539, \"acRate\": \"49.5%\"}",
|
||||
"hints": [
|
||||
"Calculate the final vector of how the robot travels after executing all instructions once - it consists of a change in position plus a change in direction.",
|
||||
"The robot stays in the circle if and only if (looking at the final vector) it changes direction (ie. doesn't stay pointing north), or it moves 0."
|
||||
|
||||
Reference in New Issue
Block a user