You are viewing a single comment's thread. Return to all comments →
I really like this solution. Only needs a single loop and string!
Note, this is technically not a single loop. Arrays.fill will iterate over the entire array to change the values.
for(int index= 0; index < arreglo.length; index++)
arreglo[index] = ' ';
Still O(n) though.
How do you figure? That's kind of like food you take off someone else's plate doesn't count for calories.