We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 153894b commit 21998c9Copy full SHA for 21998c9
README.md
@@ -34,6 +34,7 @@ This is the solutions collection of my LeetCode submissions, most of them are pr
34
|48|[Rotate Image](https://leetcode.com/problems/rotate-image/) | [JavaScript](./src/rotate-image/res.js)|Medium|
35
|49|[Group Anagrams](https://leetcode.com/problems/anagrams/) | [JavaScript](./src/anagrams/res.js)|Medium|
36
|54|[Spiral Matrix](https://leetcode.com/problems/spiral-matrix/) | [JavaScript](./src/spiral-matrix/res.js)|Medium|
37
+|55|[Jump Game](https://leetcode.com/problems/jump-game/) | [JavaScript](./src/jump-game/res.js)|Medium|
38
|66|[Plus One](https://leetcode.com/problems/plus-one/) | [JavaScript](./src/plus-one/res.js)|Easy|
39
|69|[Sqrt(x)](https://leetcode.com/problems/sqrtx/) | [JavaScript](./src/sqrtx/res.js)|Easy|
40
|71|[Simplify Path](https://leetcode.com/problems/simplify-path/) | [JavaScript](./src/simplify-path/res.js)|Medium|
src/jump-game/res.js
@@ -0,0 +1,17 @@
1
+/**
2
+ * 递归/动态规划/贪心
3
+ * 解题思路 https://leetcode-cn.com/problems/jump-game/solution/tiao-yue-you-xi-by-leetcode/
4
+ * @param {number[]} nums
5
+ * @return {boolean}
6
+ */
7
+var canJump = function(nums) {
8
+ let lastPos = nums.length - 1;
9
+ for (let index = nums.length - 1; index >= 0; index--) {
10
+ const element = nums[index];
11
+ if (index + element >= lastPos) {
12
+ lastPos = index;
13
+ }
14
15
+
16
+ return lastPos === 0;
17
+};
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments