complexitystringstips
Repeated string concatenation can copy a growing prefix
Anonymous
When strings are immutable and each append copies the accumulated prefix, building n pieces one at a time can take O(n^2) total copying. A builder or joining once can reduce copying, depending on the language and runtime.
0