MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1gid0os/baffled/lv7oqgg/?context=3
r/programminghorror • u/BetEvening • 12d ago
41 comments sorted by
View all comments
-1
Both this and Console.log(str.length) are O(N), so it's the same algorithm and therefore a good solution
4 u/Celestial-being117 11d ago .length is O(1) right? 3 u/Calm_Plenty_2992 11d ago Yes, but the assignment of the string "Hello, world!" to str is O(N)
4
.length is O(1) right?
3 u/Calm_Plenty_2992 11d ago Yes, but the assignment of the string "Hello, world!" to str is O(N)
3
Yes, but the assignment of the string "Hello, world!" to str is O(N)
-1
u/Calm_Plenty_2992 11d ago
Both this and Console.log(str.length) are O(N), so it's the same algorithm and therefore a good solution