Is O(n) enough for this question? I cannot find a better algorithm. Could any one tell me if I need a better algorithm, or I need to make my code cleaner, or I just cannot pass this with python. Thank you so much!
class Solution(object): def jump(self, nums): length = len(nums) if length == 1: return 0 steps = 1 while(nums + 1 < length): steps += 1 list = nums[1: nums + 1] for i in range(nums): list[i] = list[i] + i next_i = list.index(max(list)) + 1 nums = nums[next_i:] length = len(nums) return steps