```
class Solution {
public:
int jump(vector<int>& nums) {
int steps = 0, s1 = 0, s2 = 0;// take steps can reach s1, take steps+1 can reach s2
for (int i = 0; i < nums.size(); ++i) {
if (s1 >= nums.size()-1) return steps;
s2 = max(nums[i]+i,s2);
if (i >= s1) {//steps is not enough, update s1 to s2 and increase steps
s1 = s2;
steps++;
}
}
}
};
```