5 ms·
How to reverse a linked list in C is not hacker _news_. Additionally, sites like these are a disease. At work, I overheard a phone screen in which the intervie
by jordyhoyt 17y ago
How to reverse a linked list in C is not hacker _news_.
Additionally, sites like these are a disease. At work, I overheard a phone screen in which the interviewer asked the question, "you have a collection of numbers, all of which appear twice, except one number which appears a single time. How do you find the number?" The person being interviewed gave the "clever" answer (xor all numbers together, result is your answer) within seconds. The interviewer said, "that's nice, but not what I'm going for. What if it's a collection of strings?" She couldn't do it.
- eru 17y agoI agree. (Sorry, couldn't resist:) You can extend the clever answer to XORing the strings, if you extend the XOR-operation to strings. But I probably would not use that in production code.
- z_ 17y agoWho couldn't do it? The Interviewer or the Interviewed?
- jordyhoyt 17y agoThe interviewed
- awa 17y agoAgreed with the sentiment. The worse part is the post has 5 points which is more than some of the good posts/articles out there. Also, to give some leeway to the OP he might have been trying to point out the fact that the code had errors (which was later corrected) and showing why blindly taking advice from random blogs might be harmful for your career. In that case I would have appreciated if he had left a comment.
- jordyhoyt 17y agoGood point, I had not considered that. Agreed