5.4 variant 1 - Advancing through an array

#1

This problem asks to compute the minimum number of steps to advance to the last location. Is a solution that’s O(n) time and O(n) space sufficient? I know O(1) space is possible, but I’m not sure it can be done without pushing the time up. Thanks!

0 Likes

#2

Yes, it is doable by O(1) space.

0 Likes

#3

Sorry, just to clarify - do you mean it’s possible in O(n) time and O(1) space?

1 Like