6.4 - Replace and Remove - Time complexity

#1

Edit: My bad, I misread!
s is not a string, but an array

Replacing the a character in a string, is not O(n) because of immutability and the need to create a new string each time?

0 Likes

#2

I think the string immutability is depending on the programming language you use, and in this book we don’t depending on that for text.

0 Likes