+ 1
Can this be considered O(n)?
Sorry for the mess! https://code.sololearn.com/cUl7x6aVpMpa/?ref=app
1 ответ
+ 1
Yup. string.lower() is O(n), so is line 4, and line 5. string.replace() runs at most once so that adds another O(n).
So we are in the ballpark of 4*n operations, which is O(n) :)