Zendesk interview question

Reverse String

Interview Answers

Anonymous

2 Feb 2015

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

Anonymous

6 Feb 2019

def my_cool_reverse_function(str) str.reverse end my_cool_reverse_function('why rewrite the wheel?')