We gave this test at some dev interviews today: write a function that returns true if the word passed to it is a palindrome (the same backwards as forwards) or false if not.
The 2nd solution here is what first came to mind when solving this on my own, but I must admit, rusty as I am, I struggled a bit with the +/-1 of finding the middle character of a word like 'mom' and how to handle a word like 'toot' that has no middle character. I probably would have botched this part under the stress of an interview, especially checking for the b<a, which only came to me after debugging it. Then it occurred to me the simplest solution is to just reverse the word and compare it with the original. I have both options here.
Now here's a good interview question: Why is the second implementation more efficient?