Hacker News new | past | comments | ask | show | jobs | submit login

Out of curiosity, when the interviewer asks you to reverse a string in your language, say Ruby, are you supposed to use existing algorithms/methods built-in in that language, or to flip each character using a for-loop? In Ruby, it's really a single method called reverse will do the trick, i.e., "hello".reverse gives "olleh". I'm trying to make sense of the reason why such a question is asked.



No, the expectation is that you'll use a loop or recursion. If you use an existing method/function, the interviewer will kindly ask you to implement that yourself.

The general reason why such a question is asked is because interviewers don't have an infinite amount of time and there's no point in considering any candidate who can't do this. It's a way to weed out ridiculously bad candidates so that you can focus more on good candidates.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: