bool canJump(int* nums, int numsSize){ int maxVal = 0, i; for (i = 0; i < numsSize - 1 && maxVal < numsSize - 1; i++){ if (nums[i] + i > maxVal) maxVal = nums[i] + i; if (maxVal <= i) return false; } return (maxVal >= numsSize - 1) ? true : false; }