[Leetcode - Medium] Jump Game #52
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
문제
Constraints
1 <= nums.length <= 10^40 <= nums[i] <= 10^5Edge Case
풀이
케이스 바이 케이스별로 생각할 경우 경우의 수가 무수히 많기 때문에 일반적인 방식으로 해당 문제를 해결할 수 없다고 생각하였고 O(N)으로 풀이할 수 있는 다른 방법에 대해서 고민함.
nums[index]가 3이라면 현재 위치(index)에서 1, 2, 3만큼 점프가 가능한 것이므로, 이동할 수 있는 최대 위치만을 생각하여 문제에 접근어려웠던 점
알게된 점