Hacker News new | ask | show | jobs
by oneepic 1500 days ago
"Cool, so what do you think would be the time complexity of that? Do you think we can maybe do better than that?"
2 comments

Actually it turns out it's O(n). Which goes to show that constant factors can be more important than you think when looking at raw time complexity big-O.
Ehhhh, it's O(n) when the string to be reversed is bounded under its input window.

Because of self-attention it would grow quadratically for larger inputs, no?

Not if you also want a short poem where each word starts with a letter from the original word, and then a short literary commentary on it.