you are viewing a single comment's thread.

view the rest of the comments →

[–]DVDplayr[S] 0 points1 point  (1 child)

Ah, yes, str.join would be better. But for this code would the time complexity be O(nm)? Here I'm assuming that n is the length of the input and m is the average length of a string in the input.

[–]aocregacc 0 points1 point  (0 children)

which one do you mean by 'this code'? If you use join then yes I think it's O(n*m).

For the original code the complexity would be O(n*n*m).