Mozilla interview question

Reverse a string and explain complexities