HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
👻
개발 기록
/
코딩테스트 스터디
코딩테스트 스터디
/
Jump Game

Jump Game

Link
https://leetcode.com/problems/jump-game/
Deadline
Oct 7, 2021
Status
Archived
Type
greedy
dynamic programming

📄문제

notion image

✏️풀이

 
재영
const canJump = nums => { const target = nums.length; let maxIndex = 0; for (let i = 0; i < target; i += 1) { if (maxIndex < i) return false; const now = i + nums[i]; if (maxIndex < now) { maxIndex = now; } if (maxIndex >= target - 1) return true; } }; (() => { const nums = [0]; console.log(canJump(nums)) })();
효성
var canJump = function(nums) { if(nums.length === 1) { return true; } let max = nums[0]; for(let i=0; i<nums.length; i++) { if(max < i) { return false; } max = Math.max(max, i+nums[i]); } return true; };
은찬
희진