Of course the question is biased against certain programming languages. For example, in python:
def reverse_str(x):
return x[::-1]
works. If you remember this notation, then you'll have this problem done in 30 seconds or less. But even if you don't remember this notation, I expect a candidate to figure out
some way to reverse a string within 5 minutes in
some language. I can think of engineering roles that rarely work with strings, but in the roles I hire for, we use them a lot and so I want to know that you have the basics down. If you know that:
* strings are simply arrays of chars
* how to access an item in an array
* how to write a for loop
Then you have the tools you need to solve this problem. Are there any common languages where this is a particularly difficult problem (I'm genuinely curious, not trying to be obnoxious... if so, then I might consider changing the question for the future)?