File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ https://leetcode-cn.com/problems/walking-robot-simulation/submissions/
4545
4646## 前置知识
4747
48- - 哈希表
48+ - hashtable
4949
5050## 思路
5151
@@ -75,7 +75,7 @@ https://leetcode-cn.com/problems/walking-robot-simulation/submissions/
7575
7676- 理解题意,这道题容易理解错题意,求解为` 最终位置距离原点的距离 `
7777- 建立坐标系
78- - 使用集合简化线形查找的时间复杂度。
78+ - 空间换时间
7979
8080## 代码
8181
@@ -120,3 +120,14 @@ class Solution:
120120 ans = max (ans, pos[0 ] ** 2 + pos[1 ] ** 2 )
121121 return ans
122122```
123+
124+ ** 复杂度分析**
125+ - 时间复杂度:$O(N * M)$, 其中 N 为 commands 的长度, M 为 commands 数组的平均值。
126+ - 空间复杂度:$O(obstacles)$
127+
128+ 更多题解可以访问我的LeetCode题解仓库:https://github.com/azl397985856/leetcode 。 目前已经35K star啦。
129+
130+ 关注公众号力扣加加,努力用清晰直白的语言还原解题思路,并且有大量图解,手把手教你识别套路,高效刷题。
131+
132+
133+ ![ ] ( https://tva1.sinaimg.cn/large/007S8ZIlly1gfcuzagjalj30p00dwabs.jpg )
You can’t perform that action at this time.
0 commit comments