4 ms·
I've interviewed people in the US, and the first time I asked candidates to reverse a linked list, I was shocked by the results. Candidate A had a long track r
by ekidd 15y ago
I've interviewed people in the US, and the first time I asked candidates to reverse a linked list, I was shocked by the results.
Candidate A had a long track record of success, at least on paper. He was obviously motivated, responsible, and likable. He had done a lot of hardware work, and claimed to be a decent (but not top-notch) C programmer.
Candidate B was straight out of college, and he had a weak résumé. We suspected that he had some coding talent, but he didn't have much experience, and we had no idea whether or not he was reliable.
We were leaning heavily towards candidate A. He interviewed brilliantly and seemed like a good fit. Then I asked him to reverse a linked list, and he responded, "Do you have a copy of K&R? I don't remember what kind of braces C uses for functions." After about 30 minutes, he was still trying and failing to find a solution.
When I asked the same question to candidate B, he shrugged, and wrote out a correct solution without stopping to think. So we hired candidate B, and he did excellent work for us for years.
And this is not a one-time incident. It's amazing how many people can bluff their way through an interview without knowing how to sum the numbers in an array. Résumés are full of lies, phone screens are hard to do well, and references are hand-picked by the candidate. So I'm a big believer in coding questions.
- peacemaker 15y agoI also believe in coding questions but the linked list question in this situation wasn't a good one to use for both candidates. Why? Well of course the kid straight out of university would answer a question on data structures correctly, he probably did the class for that only a few months prior. In your example, Candidate A was obviously a no-hire after not even knowing what braces a C function uses but a lot of people similar to Candidate A who can actually code are being presented with questions about linked lists and similar structures no-one who has written code for years would remember, let alone use in their daily work lives. I want to say again, I'm 100% for coding questions but I think they should reflect more on the type of work you need the candidate to do in the job rather than some academic examples you feel you must ask just because Microsoft/Amazon do.
- ernestipark 15y agoI wouldn't consider reversing a linked list a data structures question, it's a coding question. Everyone knows what a linked list is and that you have to iterate through it and flip the "arrows". The tricky part is being able to maintain all the pointers and know how to order your operations and handle any edge cases. That's what questions like these are supposed to check for, can you actually articulate into code a solution that you understand on a high level in your head.
- araneae 15y agoIt's absolutely a data structure question. You have to know what functions are available to you from within the data structure. For instance, in a singly linked list you only have the function "getNext()" and "getHead()"; in a doubly linked list, you have additionally have the function "getPrev()" and "getTail()". If parent asked me this question in an interview I'd probably jokingly say "well, you didn't specify doubly or singly, so I'd just call getTail and then getPrev until I was done!" And then I'd write a recursive function for a singly linked list because everyone likes recursion. How could you possibly answer this question if you didn't know what a linked list was? If you never took a data structures class, you probably used "lists" but you have no idea what the bare bones construction is. Just using lists doesn't mean you know how to write one from scratch.
- RexM 15y agoIf for some reason you don't know what a linked list is, you can always ask. I think it's about admitting when you don't know something just as much as it's about being able to reason through the problem and give a correct answer. All else equal, I'd much rather hire someone who didn't know what a linked list was, but asked and answered correctly, than someone who pretended to know and limped their way through the problem, even if they did eventually give a correct answer.
- arghnoname 15y agoLinked lists are so fundamental, not knowing what they are is a big red flag. Anyone with even a modicum of curiosity about this field, college educated or not, should know what a linked list is, its complexity, and how it is structured.
- deleted 15y ago[deleted]