3 ms·
> But that also requires an O(n) walk through the input... Compressing requires an O(n) walk through the input either way.
by tpxl 3y ago
> But that also requires an O(n) walk through the input...
Compressing requires an O(n) walk through the input either way.
- orra 3y agoYes. In fact, both String.valueOf(char[]) and constructor String(char[]) are already documented as copying the array contents.