Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe10ef0

Browse files
committed
update: 33
1 parent21998c9 commitbe10ef0

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ This is the solutions collection of my LeetCode submissions, most of them are pr
3030
|34|[Search for a Range](https://leetcode.com/problems/search-for-a-range/)|[JavaScript](./src/search-for-a-range/res.js)|Medium|
3131
|41|[First Missing Positive](https://leetcode.com/problems/first-missing-positive/description/)|[JavaScript](./src/first-missing-positive/res.js)|Hard|
3232
|43|[Multiply Strings](https://leetcode.com/problems/multiply-strings/)|[JavaScript](./src/multiply-strings/res.js)|Medium|
33+
|45|[Jump Game II](https://leetcode.com/problems/jump-game-ii/)|[JavaScript](./src/jump-game-ii/res.js)|Hard|
3334
|46|[Permutations](https://leetcode.com/problems/permutations/)|[JavaScript](./src/permutations/res.js)|Medium|
3435
|48|[Rotate Image](https://leetcode.com/problems/rotate-image/)|[JavaScript](./src/rotate-image/res.js)|Medium|
3536
|49|[Group Anagrams](https://leetcode.com/problems/anagrams/)|[JavaScript](./src/anagrams/res.js)|Medium|
3637
|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+
|55|[Jump Game](https://leetcode.com/problems/jump-game/)<sup>*</sup>|[JavaScript](./src/jump-game/res.js)|Medium|
3839
|66|[Plus One](https://leetcode.com/problems/plus-one/)|[JavaScript](./src/plus-one/res.js)|Easy|
3940
|69|[Sqrt(x)](https://leetcode.com/problems/sqrtx/)|[JavaScript](./src/sqrtx/res.js)|Easy|
4041
|71|[Simplify Path](https://leetcode.com/problems/simplify-path/)|[JavaScript](./src/simplify-path/res.js)|Medium|

‎src/jump-game-ii/res.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
*@param {number[]} nums
3+
*@return {number}
4+
*/
5+
varjump=function(nums){
6+
constlen=nums.length;
7+
letend=0;
8+
letstep=0;
9+
letfurthestStep=0;
10+
11+
for(letindex=0;index<len-1;index++){
12+
constelement=nums[index];
13+
furthestStep=Math.max(furthestStep,index+element);
14+
15+
if(index===end){
16+
end=furthestStep;
17+
step++;
18+
}
19+
}
20+
21+
returnstep;
22+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp