정수형 벡터를 받는데 이 데이터는 현재 인덱스에서 다음 인덱스까지
넘어갈 수 있는 최대값이다.
0번째 인덱스에서 시작하여 마지막 인덱스까지 갈 수 있는지 판단하는 문제
class Solution {
public:
bool canJump(vector<int>& nums) {
int length = nums.size();
int step = nums[0];
for (int index = 1; index < length && index <= step; index++)
{
step = std::max(index + nums[index], step);
}
return (length - 1 <= step);
}
};