This, of course, isn't very difficult and lots of people get it wrong or give up. The following links are useful in getting the best answer, but really the best answer is how you work it out at the time. My opinion, though, is that the best answer is along the lines, "I'd look up some good examples and apply what I've learnt to the actual problem I have." This is appropriate simply because most people at work (especially when programming) are not in the firing line solving some real time James Bond type challenge and that there is usually a better solution created/invented/found by someone more intelligent/luckier somewhere in the world.
None of the points above are excuses for laziness or stupidity, however. Mostly, in my experience, points are gained by having experience and applying it well. Therefore;
- Come on, it's google: http://www.google.co.uk/search?rlz=1C1CHMB_en-GBGB316GB316&sourceid=chrome&ie=UTF-8&q=string+reverse
- Because String.Reverse doesn't exist in C#: http://www.123aspx.com/ReadReviews.aspx?res=617
- A good internal for a reverse function: http://weblogs.sqlteam.com/mladenp/archive/2006/03/19/9350.aspx
- Microsoft Interviews: http://en.wikipedia.org/wiki/Microsoft_interview
It's also worth noting that:
string reversed = forwardStr.Reverse();
does not work. See link above.
I'll include some extra links here, found recently while pondering the current state of affairs in the world. It's interesting to note that (it seems) a large number of interviews think that some (alleged) programmers are not, in fact, programmers...