TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

I Don't Want to Hire You If You Can't Reverse a Binary Tree

47 点作者 cherry_su大约 9 年前

32 条评论

minimaxir大约 9 年前
This submission is surprisingly <i>not</i> satire, and misses the points of the arguments around whiteboard coding. (the added interview stress and the limited real-world applications of the code in day-to-day work)<p>It is <i>not</i> an accurate measure of candidate technical skill, hence the rise of take-home tests. (the submission reminds me of the blog post &quot;I Won&#x27;t Hire You If You Can&#x27;t Pass These Programming Questions Because Otherwise You Suck&quot; that was written awhile ago but I can no longer find. That post backfired hilariously because author provided the wrong solution for one of the questions.)
nanis大约 9 年前
A long time ago, I interviewed with a major bank. As part of an all day grilling (arrive in city at 1 am, interviews start at 7:30 am, last until 6:30 pm with a lunch break), after lunch, I was given a programming task. By that time, I had already been interviewed by three people. The task was something that may have sounded trivial at first blush. I was given a computer and an hour.<p>After the hour was up, my code was reviewed by six people while I interviewed with the DBA who took joy in pointing out my admitted deficiencies with SQL. I then had another hour discussing the code with the six reviewers.<p>The program worked on the sample data I was given. I was later told that the other candidate&#x27;s programs also worked on the sample data. Except, mine was the only one which actually ran to completion with their real data sets. I was also the only interviewee without a formal CS &quot;education&quot;.<p>I got an offer which I ended up not taking due to location considerations.<p>If you are going to ask someone to write code, give them a computer and some quiet time. You can grill them about the thinking process <i>after</i> they came up with something. Having someone watch over one&#x27;s shoulder every time one puts a pen to the stupid whiteboard will eliminate a lot more candidates for the wrong reasons than one ought to consider desirable.
victorhugo31337大约 9 年前
Couldn&#x27;t disagree more with the author. How many developers need to implement their own binary-tree? This is why code-bases become convoluted with six different implementations of standard data structures.
评论 #11551174 未加载
评论 #11551168 未加载
评论 #11551188 未加载
评论 #11551245 未加载
gariany大约 9 年前
I lost him at: &quot;I think homebrew is an awful piece of software that should never be used by anyone.&quot;
评论 #11551162 未加载
评论 #11551262 未加载
评论 #11551236 未加载
评论 #11551395 未加载
评论 #11552028 未加载
评论 #11551251 未加载
评论 #11551278 未加载
ToastyMallows大约 9 年前
&gt; &quot;Just about everything you do in your programming career will be related to trees.&quot;<p>I&#x27;ve never knowingly used a tree structure since college, everything is abstracted away from me. Now whether this is a good thing or a bad thing remains to be seen, but it has not been a problem yet.
评论 #11551290 未加载
评论 #11551267 未加载
levemi大约 9 年前
&gt; &quot;Bad programmers worry about the code. Good programmers worry about data structures and their relationships.&quot;<p>The sizable problem with this statement is that it is using a solution to pigeonhole a person. It takes a bit of audacious hubris, something Torvalds (an extraordinary engineer no doubt) is known for, to paint an entire person and their capacity and skill into a singular and simple quote.<p>Here&#x27;s a novel idea: sometimes a person is a good programmer and sometimes they&#x27;re a bad programmer. There&#x27;s definitely a skill level that people fall into, but these aren&#x27;t neat lines delineated with tired generalisms about &quot;worrying about code&quot; versus worrying about &quot;data structures&quot;. Put your question into an interview and get different people to ask it and sure pick the people who were able to get a better solution. Hopefully you&#x27;re asking more than one question. That&#x27;s totally OK, but please don&#x27;t attribute someone&#x27;s performance at one question or assume that you&#x27;ve mastered everything it takes to know to paint someone as a &quot;bad programmer&quot; from one interview loop[0] or performance with their performance for that one question.<p>Sometimes it&#x27;s obvious someone has no idea what they&#x27;re doing and you can tell that from a question, but even in that case they could become better. There might be a weakness in a fundamental area they need to learn and sure you don&#x27;t want to hire them until they do, but that doesn&#x27;t make them a &quot;bad programmer&quot;. All it is is a specific problem that the candidate should recognize and improve on to up their skill. They shouldn&#x27;t walk away from your massive ego rethinking their career as you puff your chess out and write a haughty blog post about what you think about people and their skills.<p>[0] <a href="http:&#x2F;&#x2F;steve-yegge.blogspot.com&#x2F;2006&#x2F;03&#x2F;truth-about-interviewing.html" rel="nofollow">http:&#x2F;&#x2F;steve-yegge.blogspot.com&#x2F;2006&#x2F;03&#x2F;truth-about-intervie...</a>
评论 #11551526 未加载
wvenable大约 9 年前
&gt; Trees are the single most important data structure in computer science.<p>And yet I&#x27;ve never professionally had to reverse one or know if they are symmetrical.
评论 #11552530 未加载
评论 #11551312 未加载
jere大约 9 年前
<i>Invert</i>. <i>Invert</i> a binary tree. Max never gave any details on what that meant exactly, but the question is not necessarily the same as reversing a tree.<p>Also, way to back up your claim that Homebrew is bad software by pointing to another guy <i>not explaining anything about Homebrew but just dogpiling on Howell again</i>.
voidhorse大约 9 年前
Terrible way to hire in my opinion.<p>Personally, I&#x27;d rather hire employees who are resourceful, can admit when they don&#x27;t know something, can follow up with others and conduct proper research to tackle cases where they don&#x27;t know the solution to a problem, and most of all, are a pleasure to work with and bring good and diligent attitudes about work into the office.<p>Hiring based on questions like this will get you someone ahead of the curve who perhaps you can trust to execute well immediately but will probably turn out to be a massive pain in the rear in the long run.<p>I&#x27;d rather hire people with good attitudes and willingness to learn and spend the extra time training them and helping them out rather than hire someone because they happened to get in enough rote technical exercises before coming into the interview.
kwindla大约 9 年前
By coincidence, I just posted some notes on what I&#x27;ve learned over the last 15 years of hiring software engineers. I prefer giving people real-world, fairly large, programming tasks to do, and then having them talk through the code they write, rather than posing puzzle-style questions.<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@kwindla&#x2F;hiring-software-engineers-98498cf6f2a#.dvbuqw664" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@kwindla&#x2F;hiring-software-engineers-98498c...</a><p>(This is also on HN&#x2F;new right now.)
apitaru大约 9 年前
I found the spirit of article a bit narrow-minded for all the reasons mentioned here already.<p>It did however make me think of an almost opposite activity for the next time I interview someone:<p>Pick a difficult trick question (like Binary Tree reversal but harder&#x2F;arcane) that neither of us can solve, and spend some time working on the problem together with the candidate.<p>After all, solving problems together (directly, or indirectly) is what we&#x27;ll be doing day to day.<p>This might not be a good idea, but I&#x27;ll definitely try it out once and find out.
Torgo大约 9 年前
It&#x27;s not a &quot;brain teaser&quot; or a &quot;trick question&quot;. It&#x27;s an ordinary software engineering problem.
评论 #11551399 未加载
Delmania大约 9 年前
&gt; By the time I get to the whiteboard stuff, I&#x27;m looking for someone to want to engage with me, not an attempt to stump them.<p>Dredging this comment, because while this article is not about whiteboard coding, it would inevitably be mentioned.<p>I think many people, including many interviewers, completely miss the point of whiteboard coding. I think this article needs to be shared: <a href="http:&#x2F;&#x2F;darrenkopp.com&#x2F;posts&#x2F;2013&#x2F;04&#x2F;19&#x2F;Post-mortem-of-my-failed-interview.html" rel="nofollow">http:&#x2F;&#x2F;darrenkopp.com&#x2F;posts&#x2F;2013&#x2F;04&#x2F;19&#x2F;Post-mortem-of-my-fai...</a><p>The key point is that the interviewer is, or should be, a friend. He should not be out to stump a person or out to get him; he should genuinely want a person to succeed at the interview. If not, it&#x27;s better just to reject the person outright. White board coding should be seen as a way for person to engage in collaborative problem solving, which is something that we do on a daily basis. Can you explain your thought process? Can you admit your stuck? Can you have an intelligent discussion about your solution, listen to feedback, etc. The problem should be challenging and relevant, but it should not be a test of coding skill.
leovonl大约 9 年前
You don&#x27;t reverse a binary tree, you iterate in the opposite direction (right-to-left). Reversing is generally a pointless operation, and which would be much more efficient if not done at all.
Delmania大约 9 年前
As I mentioned in my response, knowing that trees are used for various artifacts is important for the people who are implementing said artifacts. A well done implementation hides that detail, focusing on ensuring the implementation is correct. To use his analogy of Wehlings, there are standard procedures for blood transfusions, and the doctor doesn&#x27;t need to know about the heart, he just needs to know who to ask since he doesn&#x27;t work in a vacuum.<p>The other thing is that knowing a tree is symmetric and know how to reverse one don&#x27;t count as new and unknown challenges that author mentions. Both are well documented and easily accessible to anyone who needs to know that information.<p>I recently had an interview where I was presented with a problem the company had to solve. That was new and exciting, not some minor detail from CS100 I learned years ago.
gone35大约 9 年前
I don&#x27;t know JavaScript (maybe it somehow handles this automagically) but isn&#x27;t his reverse function missing the base case of a NULL tree?<p><pre><code> function reverse(t) { var tmp = t.left; t.left = reverse(t.right); t.right = reverse(tmp); return t; }</code></pre>
评论 #11551416 未加载
pan69大约 9 年前
I think the problem with interview questions is the following;<p>Asking candidates about algorithmic problems is great, if that&#x27;s what you&#x27;re hiring for. However, what has happened over the past decade is that a lot of companies who aren&#x27;t even close to solving those kind of problems (e.g. digital ad agencies, web dev &amp; mobile app shops) have started to ask these kind of puzzle questions in their interviews because &quot;that&#x27;s what Google does&quot; and if Google does it, well, then it must be good.<p>Interviewing is hard and hiring the right candidate is even harder. A lot of interviewers don&#x27;t even come close to having the experience of hiring a fellow colleague. A lot of these interviewers are basically hiring themselves meaning; if the interviewer has a PhD then the candidate they&#x27;re looking should also have a PhD. If the interviewer loves Haskell then the candidate should also have this quality, if the interviewer can reverse a binary tree then, well.. regardless whether or not this has any application to the position they are hiring for,<p>When I interview I try to look for smart people who can explain and articulate problems well. I&#x27;m looking for people who are thoughtful and have a strong sense of integrity and an absence of ego. If they can talk about building software and programming I can easily spot if they bullshit or not. Smart people can easily learn how to reserve a binary tree.
ketralnis大约 9 年前
This misses the point. You showed how easy it is to do this stuff in a real text editor without a time constraint with the luxury of testing and research before you published the post about how easy it is. That&#x27;s not at all the same as solving an artificial problem on a whiteboard while nervous and in a rush and no ability to test or research
dimgl大约 9 年前
That&#x27;s okay; I definitely don&#x27;t want to work for you either.
strommen大约 9 年前
It&#x27;s all about context.<p>If your software team works on code with lots of binary trees, interview questions about them makes a ton of sense.<p>If your software team is making a website that just displays stuff from databases and web services, interview questions about binary trees makes no sense at all.
评论 #11551379 未加载
btilly大约 9 年前
He undermines his own point by pointing to dictionaries as an example of something that uses trees. Which suggests that he doesn&#x27;t know that dictionaries in most languages are implemented as hashes, and hashes are NOT based on trees!<p>The truth is that interviews should test the skills your job actually requires. For a variety of skills outside of that core, it is valuable to have someone on your team who understands it for other people to go to. But if you&#x27;re not doing algorithms all the time, you don&#x27;t need or want everyone to have mastered that.<p>And I say this as someone who knows algorithms well enough to pass his interview.
rabbyte大约 9 年前
&gt; &quot;Skill in software engineering, like skill in any subject, is not cultivated by limiting yourself to a narrow set of knowledge and challenges.&quot;<p>Except you&#x27;ve done exactly this by selecting tree structures, something you find intuitive, and using it as a measurement for everything else. If you hire like this you will be successful in surrounding yourself with others who think just like you. Maybe that&#x27;s a strength for the product you&#x27;re building but it&#x27;s a strength achieved by limiting yourself to a narrow set of knowledge.
crispyambulance大约 9 年前
I think some folks get hung up on the idea that the answer to one question can be used as a go&#x2F;no-go for a hire decision.<p>Its never that simple, there&#x27;s a lot more to consider, and the vast majority of candidates will bomb a technical question or two eventually.<p>For those of you that are job hunting right now... don&#x27;t get bent out of shape, there are plenty of employers that won&#x27;t hinge their acceptance on one technical brain-teaser.
评论 #11551394 未加载
Lendal大约 9 年前
I don&#x27;t want to work at a place where reversing binary trees is so important to your everyday work that it deserves a place in the interview process.
dkarapetyan大约 9 年前
Wait. This is the same guy that uses the MEAN stack and likes to think he can distinguish good software from bad. Obvious troll.
评论 #11552898 未加载
tomjohnson3大约 9 年前
ironic that his reverse function is incorrect.
评论 #11551520 未加载
sharemywin大约 9 年前
In all fairness he does work for a DB company.
planetjones大约 9 年前
Bad article IMO and no idea how it&#x27;s front page. Yes a database may rely on b trees under the hood, but thankfully someone else has implemented that complexity so my web developer can concentrate on higher level interactions with it.<p>His herpes analogy is ridiculous. And I&#x27;ve used brew since getting a Mac and no I&#x27;m not suffering now.
评论 #11551204 未加载
评论 #11551195 未加载
pacomerh大约 9 年前
These questions shouldn&#x27;t be asked expecting an exact solution in the whiteboard, this adds layers of stress and time. They should be asked expecting an explanation of how they work conceptually. You want to see if the person understands the methods used to traverse, sort, manipulate them. Are they important?, of course.
smt88大约 9 年前
Many working programmers will disagree with this article. That&#x27;s a good start, but we should also work toward ending this practice:<p>1. If your company does it, you should try to end it. Research alternatives and propose them. Take-home problems that mimic real problems at your company might be an option, as would hiring someone for a few contracting hours to do solve real problems before hiring them full-time.<p>2. If you apply to a company that uses these questions, politely excuse yourself from the process (assuming you are at the point in your life where you can refuse offers). That company probably doesn&#x27;t really have the employee-focused culture you&#x27;d want to be a part of. If enough candidates refuse to do these tests, we might see them decline in prevalence.<p>3. If your company used interview methods like this and then stopped, try to create a case study. What did your company switch to? Do you have data to back up the perceived benefits of the switch?
mrpoptart大约 9 年前
Small edit would improve your statement a lot: I Don&#x27;t Want to Hire You If You Can&#x27;t Learn How to Reverse a Binary Tree
askyourmother大约 9 年前
Sigh. If you hire using know it or not questions about binary trees, then you finally get to hire people who can study up and answer that specific question in a manner Pavlov would approve of.<p>That does not mean the candidate will be able to design clean APIs, know how best work with different types of data, or even how to troubleshoot existing code.<p>Still, pat yourself on the back, I mean, your entire team can answer a specific trick interview question, and that&#x27;s all that matters, right? Right?<p>Sigh.
评论 #11551475 未加载
评论 #11551232 未加载
评论 #11551248 未加载
评论 #11551263 未加载
评论 #11551407 未加载
评论 #11551240 未加载