public int jump(int[] nums) {
        if (nums == null || nums.length <= 1)
            return 0;
        int curMax = nums[0], nextMax = 0, step = 0, i = 1;
        if (curMax >= nums.length - 1)
            return step + 1;
        while (i < nums.length) {
            ++step;
            for (; i <= curMax; ++i) {
                nextMax = Math.max(nextMax, nums[i] + i);
                if (nextMax >= nums.length - 1)
                    return step + 1;
            }
            curMax = nextMax;
        }
        return step;
    }