This looks like O(n), because you don’t include constants when calculating Big-O. It’s still ~26 times slower than the implementation without the inner loop.
This looks like O(n^2) because of the sub.
I was right the first time. sub is “substring” and not “substitute”.
I hope this is O(n!)
This looks like
O(n), because you don’t include constants when calculating Big-O. It’s still ~26 times slower than the implementation without the inner loop.This looks likeO(n^2)because of thesub.I was right the first time.
subis “substring” and not “substitute”.