Reverse a String / by Zach Mayer

A really quick one today since I don't have a whole lot of time.

Reversing a string is the same as reversing an array. There are a few ways to do it and most are linear algorithms to one degree or another. Where solutions differ is more often not on speed or complexity but on readability. That said, here's the one I like best. It's O-n/2, which makes it nice and linear and it's easy to intuitively understand what's happening from even obfuscated code.

This sort of problem in an interview can easily be made part of a larger problem set like finding palindromes, but mostly it's a Fizz-Buzz style smoke test for fundamentals comprehension.