Isn’t the space complexity in that example O(n) where n is the number of elements in the sequence? Because we do create a new array ‘result’ where we append the values. If k < len(sequence) the space complexity O(n) right?

Isn’t the space complexity in that example O(n) where n is the number of elements in the sequence? Because we do create a new array ‘result’ where we append the values. If k < len(sequence) the space complexity O(n) right?

0 Likes