Quick way to reverse a string: walk through the array from each end and swap the characters until you meet in the middle. O(n) time and doesn't require additional storage since its in place.
4
Anónimo
6 feb 2019
def my_cool_reverse_function(str)
str.reverse
end
my_cool_reverse_function('why rewrite the wheel?')