13 ms·
One of the interview questions I've used in the past is "reverse a linked list". Indeed, you (almost) never need to reverse linked lists in practice - but you
by beagle3 9y ago
One of the interview questions I've used in the past is "reverse a linked list".
Indeed, you (almost) never need to reverse linked lists in practice - but you often need to chase references of one kind or another (database, pointers, etc.) and do some manipulations on them that would result in a different list. If you have 20 data points, it doesn't matter what you do, but if you have 100M or 10B points, it makes a great deal of difference whether you do O(n), O(n log n) or O(n^2) or O(n!).
I think this is a good question, because it is an abstract version of the kind of problems that any non trivial code has to address. It is easy to describe, and easy to solve if you know what you are doing. I don't use it anymore because it's too common to be useful.
And yet, through the years I've gotten the feedback[0] that it is "far detached from real work", "tests how good I did in school rather than how good I am" and various other comments -- and almost always from candidates who did poorly; I've never gotten this feedback from anyone I would consider competent.
[0] I try to get feedback through whoever referred the candidate, whether it's the friend-of-acquaintance, or the recruiter. I don't, in general, trust direct feedback from someone I turned down (or hired, for that matter).
- sidlls 9y ago> I don't, in general, trust direct feedback from someone I turned down (or hired, for that matter). That's a problematic attitude, in my view. It reads to me that you think you have all the answers already, or at the very least that you view yourself as being superior to people you interview. That lack of humility is troublesome for a number of reasons. As far as your interview question, do you normally not interview candidates to develop software? Your question is appropriate for a grunt who's entire responsibility is to thoughtlessly code up somebody else's design. It's not appropriate for someone expected to contribute thoughtfully to the engineering of a software product.
- beagle3 9y ago> That's a problematic attitude, in my view. It reads to me that you think you have all the answers already, or at the very least that you view yourself as being superior to people you interview. That lack of humility is troublesome for a number of reasons. I would correct that (if I could still edit) to "direct immediate feedback". What I meant was, if someone I just turned down for a job says "it's stupid", I don't consider that useful data; similarly, if someone I just hired says "This is the best interview question ever", I don't consider that useful data either. I do ask for, and usually get, direct and raw feedback from people I work with (both those who report to me and those I report to). > As far as your interview question, do you normally not interview candidates to develop software? Your question is appropriate for a grunt who's entire responsibility is to thoughtlessly code up somebody else's design. It's not appropriate for someone expected to contribute thoughtfully to the engineering of a software product. Can you elaborate on what you consider "contributing to the engineering of a software product"? and more generally what "software engineering" entails? I mentioned as explicitly as I can that I do not expect anyone to reverse linked lists. However, it is an abstract question that is not unlike the kind of things that arise in practice, e.g. figure out inverse relationships in data. And gives a good ground for discussion about things like requirements (time, space, correctness, verifiability, boundary conditions, erroneous inputs, etc) -- inside a well defined and (supposedly) familiar context; The same problem in a business setting would require a lot more definitions and would be frighteningly foreign for some people (to digest within an interview). How do you interview?
- sidlls 9y ago> Can you elaborate on what you consider "contributing to the engineering of a software product"? and more generally what "software engineering" entails? Actually, not in a space appropriate for an HN comment. Here's a very brief summary: I think in its current state there is very little actual engineering in this industry. It seems to me to consist of a large number of folks who approach every problem like a CSX01 project. It could move toward a more mature engineering footing if there were less focus on CS trivia and more on broader, deeper understanding of systems and relationships between them. To be blunt, your "reverse a linked list" question is something I consider an example of the Law of the Instrument (https://en.wikipedia.org/wiki/Law_of_the_instrument https://en.wikipedia.org/wiki/Law_of_the_instrument): every problem is a CS nail to hit with a CS hammer. It's great for exploring the items you note at a very low, narrowly-scoped, and shallow level. It's not so good for gauging actual problem solving ability or engineering ability. > How do you interview? Interviewing is a crap shoot, and my methods are at least as flawed as any others'. Phone screens with a shared editor are the place I ask questions like yours, except I'm not looking for a correct implementation, complete solution or discussion about it: I'm looking to see if they at least have some vague notion of what writing source code entails (even if it's just because they read about it and memorized it). At the in-person interview I tend to do two things: discuss in depth a project in the person's past and a higher level discussion about something pertinent to their work at the company. For me the latter has varied from details for some feature to be implemented in a real time system to motivating a data exploration approach in the context of developing a data science product.
- beagle3 9y ago> I think in its current state there is very little actual engineering in this industry. Agreed. > It's not so good for gauging actual problem solving ability or engineering ability. Also agree. It is not the only question I ask. However, I only want to hire people who, when the need arises, can actually use a hammer. I am perplexed that people find that offensive. > At the in-person interview I tend to do two things: discuss in depth a project in the person's past and a higher level discussion about something pertinent to their work at the company. For me the latter has varied from details for some feature to be implemented in a real time system to motivating a data exploration approach in the context of developing a data science product. Agree. However, I also do some technical parts in person/
- kstenerud 9y ago> I think this is a good question, because it is an abstract version of the kind of problems that any non trivial code has to address. It is easy to describe, and easy to solve if you know what you are doing. I don't use it anymore because it's too common to be useful. This is precisely the problem the OP is talking about. When's the last time you ever did anything as low level as reversing a linked list? It's a solved problem, and something an employee would NEVER do in your company, let alone search for the optimal solution in 10 stressful minutes while you breathe down his neck. > And yet, through the years I've gotten the feedback[0] that it is "far detached from real work", "tests how good I did in school rather than how good I am" and various other comments -- and almost always from candidates who did poorly; I've never gotten this feedback from anyone I would consider competent. Major red flag. I don't mean to be rude, but this sentence comes off as very arrogant. > I don't, in general, trust direct feedback from someone I turned down (or hired, for that matter). Why? Because they're in a lower caste? If you can't handle direct feedback, you're a terrible manager.
- theprotocol 9y ago>This is precisely the problem the OP is talking about. When's the last time you ever did anything as low level as reversing a linked list? It's a solved problem, and something an employee would NEVER do in your company, let alone search for the optimal solution in 10 stressful minutes while you breathe down his neck. The thing about such things is I know I can do it. But maybe it'll take 5 minutes, or maybe an hour. Maybe I'd attempt to do it differently given an unfamiliar scenario for which to be doing this in the first place; maybe I've never done this specific task in this specific language, and I'll take some extra minutes figuring out how pointers or references work in the language I'm using in the test. Maybe I've recently enjoyed some momentum on high level concepts (i.e. I produced software that fulfills a business need) and it'll take me a while to refocus my attention on low level implementations. Engaging one's brain carries some very variable overheads. If you just give me 5 minutes and watch me write every single line of code and comment about it while I'm doing it, then it's just not going to happen.
- burgerdev 9y ago
- cheetos 9y ago> I don't, in general, trust direct feedback from someone I turned down (or hired, for that matter). Would you please share where you're working so we can avoid applying?
- beagle3 9y ago(I understand the sentiment, and I deserve it for the wording that I cannot edit now -- but, copying myself from other posts: I would correct that (if I could still edit) to "direct immediate feedback". What I meant was, if someone I just turned down for a job says "it's stupid", I don't consider that useful data; similarly, if someone I just hired says "This is the best interview question ever", I don't consider that useful data either. because I've just hired them, or just didn't hire them; either way, I think it is irresponsible to trust the statement of a person I don't actually know and who may either hold a grudge or want to please me right now. I meant to say "direct immediate feedback", which is perhaps better wording. After I know a person, I ask them (and usually get) the most direct and raw feedback I can get.
- jaggederest 9y agoYou miss the point. Everyone has something interesting to teach you. Listen to the sages and the sycophants alike because there's no profit in closing yourself off.
- poikniok 9y agoBut in this case we have all the people who didn't make it to the NFL complaining about the NFL combine, and how in actual football they don't have to bench 225 pounds.
- kittiepryde 9y agoI thought this guy was being sarcastic?
- quickben 9y agoBecause it's considered very rude by normal people. For a hypothetical example: I've spent a day for your interview. I aced it. I was told there is somebody better. I was then asked to waste more time in form or feedback. Same goes for references. In fact, from a real life example: My company needed an entry level technical writer. I referred them this kid with a fresh comp sci degree, eager for a job. Reviewing code: yay, he thought he made it. Got turned down because they wanted only a rockstar entry level, technical writer. Then chose to not get one. So, given everything, because I'm a polite person, I'd rather not answer than tell them they are delusional and rude.
- derf_ 9y ago> I don't use it anymore because it's too common to be useful. I've found that having common questions used across many interviews allows for more objective direct comparisons. I like this one in particular because even if they solve it quickly, you can move on to questions about cycles in the input. What do you use now?
- beagle3 9y agoIt was never my only question.. I vary through the years. Another favourite of mine is basically "implement a very sparse 100Mx100M matrix". Thought process much more important than result. (important things to consider: access time, storage size, static vs. dynamic, use cases, adversarial coordinate selection). I actually consider the "cycles in the input" question a bit of a trick question -- I calibrated the test on people I knew were good, and no one who didn't know it already was able to come up with "the trick" in reasonable-settings-for-interview-time, and not many were able to come up with any O(1)space O(n)time solution. The discussion with those who don't know the solution is useful, of course.
- derf_ 9y ago> The discussion with those who don't know the solution is useful, of course. Agreed, the discussion on these questions is the whole point, not whether you can come up with a "correct" solution (and I tell candidates this up front). I generally draw a small example input with a cycle, and ask what their list-reversing solution will do with it, which I feel makes it much less of a trick question. "Can you work out what the code you just wrote will do with inputs that don't meet the assumptions you made?" seems like a fair thing to ask anyone who will be required to write code that handles untrusted data.
- fenomas 9y ago> I've never gotten this feedback from anyone I would consider competent. You may not have gotten it personally, but some very smart people have given precisely that feedback regarding those sorts of questions. https://twitter.com/mxcl/status/608682016205344768 https://twitter.com/mxcl/status/608682016205344768
- beagle3 9y agoOn phone now, so can't search but ... there were a couple of threads on HN when that tweet was made, and IIRC the majority actually didn't think he was in the right. Being smart and being a good fit are not equivalent. Linus Pauling was definitely smart - and most definitely wrong about quite a few things (most famous was his statement that "there are no quasi crystals, only quasi scientists", a derogatory remark about Dan Shechtman who later got a nobel prize for those quadicrystals)
- fenomas 9y agoThe tweet isn't a counterargument that disproves your premise; it's a data point you seem to be unaware of. Certainly there are smart people who think your question is fine, but if you think that the people who disagree are mostly incompetent, I think that's a defense mechanism. Put it this way: if I decided someone was incompetent as a programmer based on some criteria, and then I later found out that that person wrote Homebrew, I would take a pretty hard look at the criteria, and how strongly I believed in its predictions.
- beagle3 9y agoWith all due respect for Max Howell, his response is a defense mechanism. "invert a binary tree" is an ill defined question (maybe he was joking, I don't know), perhaps he didn't even understand what he was asked and didn't bother inquiring. He was not told WHY he wasn't accepted - it might have been for displaying a "rock star better than though" attitude which some places reward but Google does not. I do not disqualify people who cannot reverse a list (as long as they demonstrate critical thinking skills and reasonable capability). I do disqualify people who get up in arms like Howell did, and I dare say this tweet does show Howell to be a bad match for many teams, regardless of his technical skills; He is likely not a competent team player. (As much as can be inferred from the tweetstorm that happened 2 years ago, and as much as I can remember it).
- tvaughan 9y ago> Indeed, you (almost) never need to reverse linked lists in practice And there are thousands of other things that you (almost) never have to do, yet you do, throught the course of your career. When they arise you're not an expert in them, but after some careful research you become one, or become enough of one to say which solutions are better than others for the problem you have. And you'll be able to implement it, support it, and explain it to the people with whom you work. These types of interviews don't see the forrest for the trees. The problems that you have had won't always be like the problems that you will have. What's important is the ability to solve problems you've never seen before (a graphql request took down the database cluster), not recite known but not widely remembered tasks (balance a b-tree in-place). Getting to the point where you have to start to worry about Big O is the hard part, not the other way around. And Jesus, I really hope we work in places where if you're unsure about Big O you can ask someone and they'll help you, not judge you. Edited to add: What these types of interviews say to me is the companies who use them have no interest in their employees growth and education.
- beagle3 9y ago> What's important is the ability to solve problems you've never seen before Most definitely! And that's exactly why I no longer use this question (as I wrote in my original post) -- by now, everyone has seen it. > Getting to the point where you have to start to worry about Big O is the hard part, not the other way around. And Jesus, I really hope we work in places where if you're unsure about Big O you can ask someone and they'll help you, not judge you. I disagree. I deal with lots of data (just ordered another 100TB storage the other day; I do that every couple of months these days). Toy solutions that work well for small 100GB datasets often don't extend. Without a good grasp of complexity, it is easy to build solutions that don't scale properly, or cost $100K more in hardware/AWS than they should. I've seen it happen a lot of times. As they say, "a year in the lab can save you a week in the library!". If you don't know that you should go to the library, you're likely to lose that year. > What these types of interviews say to me is the companies who use them have no interest in their employees growth and education. Some of us are bootstrapped in a cut-throat market and can't afford to plan employee retention 10 years into the future; And neither are most employees interested in that.
- nolepointer 9y agoBy linked list, do you mean a doubly-linked list?
- SAI_Peregrinus 9y agoWouldn't that make it (even more) trivial, since you can just traverse from the tail backwards? Assuming it has a tail pointer, of course.
- nolepointer 9y agoYeah, I suppose so. I only asked because reversing a singly-linked list just seems like a PitA.
- duskwuff 9y agoReversing a singly-linked list is actually easier: you take each element off the front of the old list and put it onto the front of the new list.
- tome 9y agoI'm astonished how you've been treated in this thread. You've actually mananged to convince me that reversing a linked list is a good interview question!
- posterboy 9y agoFrom your submissions you seem to be keen on sorting algorithms and some low level programming, so I'd say you are somewhat biased on what programming skills are important, while I wouldn't even necessarily disagree with it, depending on the specifics of the job to interview for. My replies to dodge the question would be: That's not a question, that's a command.
- Corrado 9y agoI think this is a great question and tests basic programming knowledge. It's similar to the parallel parking portion of our state's driving test. Most people don't parallel park enough for it to be a factor in daily use but it's a good way to test overall knowledge and control of the vehicle. If you can parallel park, it's a good indicator that you can do other things safely as well.