I just looked at the source code of left-pad for the first time, and it's strange. They noticed that concatenating a bunch of single-space strings is O(n^2), and optimized it to O(n log n) by using repeated doubling. So in the end they take longer than O(n) to fill an array with a constant value. Why?