Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d5a2ef

Browse files
authored
Update 55.jump-game.md
1 parent 9936c26 commit 0d5a2ef

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

problems/55.jump-game.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ Explanation: You will always arrive at index 3 no matter what. Its maximum
2626

2727
## 思路
2828

29-
这道题目是一道典型的`回溯`类型题目。
30-
思路就是用一个变量记录当前能够到达的最大的索引,我们逐个遍历数组中的元素去更新这个索引。
31-
变量完成判断这个索引是否大于数组下表即可。
29+
这道题目是一道典型的`贪心`类型题目。思路就是用一个变量记录当前能够到达的最大的索引,我们逐个遍历数组中的元素去更新这个索引。变量完成判断这个索引是否大于数组下表即可。
3230
## 关键点解析
3331

3432
- 建模 (记录和更新当前位置能够到达的最大的索引即可)
@@ -38,7 +36,6 @@ Explanation: You will always arrive at index 3 no matter what. Its maximum
3836
* 语言支持: Javascript,Python3
3937

4038
```js
41-
4239
/**
4340
* @param {number[]} nums
4441
* @return {boolean}
@@ -71,3 +68,11 @@ class Solution:
7168
return True
7269
return _max >= _len - 1
7370
```
71+
72+
***复杂度分析***
73+
- 时间复杂度:$O(N)$
74+
- 空间复杂度:$O(1)$
75+
76+
更多题解可以访问我的LeetCode题解仓库:https://github.com/azl397985856/leetcode 。 目前已经30K star啦。
77+
78+
大家也可以关注我的公众号《脑洞前端》获取更多更新鲜的LeetCode题解

0 commit comments

Comments
 (0)