```
int jump(vector<int>& nums) {
//step[i] stores the min step from index 0 to each i
vector<int> step = vector<int>(nums.size()+1, 0x7ffffff);
step[0] = 0;
for (int index = 1; index <= nums.size(); index++) {
for (int s = 0; s < index; s++) {
if (nums[s] + s >= index){
step[index] = min(step[s]+1, step[index]);
}
}
}
//return the min step when reach nums.size()
return step[nums.size()];
}
```