11 ms·
Jesus christ. Inverting a binary tree is not hard. That people keep using this as a joke is more a testament to the stubbornness of people believing they shoul
by moron4hire 5y ago
Jesus christ.
Inverting a binary tree is not hard. That people keep using this as a joke is more a testament to the stubbornness of people believing they shouldn't have to do no learnin' no more than it is bad interviewing practices.
- mcntsh 5y ago> shouldn't have to do no learnin' Expecting engineers to develop skills they don't learn/use in their actual professions to prove they're capable of working a job makes no sense. If these leetcode puzzles were actually relevant, why do so many engineers have to spend time outside of work "grinding" in order to get better at them?
- dahart 5y ago> Expecting engineers to develop skills they don’t learn/use in their actual professions to prove they’re capable of working a job makes no sense. I used to feel this way, but I think I’ve changed my mind. Interviews aren’t really primarily testing for skills you’ll use day to day, they’re testing for breadth of skills and knowledge and more importantly breadth of understanding. When I’m interviewing, knowing if the candidate has the specific skills for the job is the bare minimum needed to get in the door. I’m really more interested in potential, how much they can grow, and indicators of growth potential include how interested they are in the art of programming in it’s many different forms, whether it’s algorithms or math or software architecture, or coordinating people who write software. Puzzles are only the tiniest fraction of all that, but they’re still a signal that you like thinking about algorithms, and have exposure to different ways to write code and lots of algorithmic concepts. A university CS degree isn’t particularly good at teaching job skills per se either, there isn’t much I use in my job day to day that I practiced in school, at a superficial level. But the school degree is pretty good at covering the broad concepts of computer science, and that has lasting value over the course of a software career.
- otterley 5y agoHow do these questions give you any indication that the candidate can do the essential job functions of shipping working code that is actually useful to your business and being a good teammate?
- moron4hire 5y agoThat question is impossible to answer. However, the negation is answerable. "Is the candidate incapable of the essential job function?" Questions like fizz-buzz, et. al. answer that readily. Put up a job posting on a job board and you'll get hundreds of applications. 90% of those you're going to throw out because the resume doesn't match the job description at all. What does that tell you about the candidate pool? It's an all out assault of candidate spam. You have to employ these sorts of basic filters to even get the number of interviews you do down to a managable number.
- Jiro 5y agoWhat it tells you about the candidate pool may be less than what it tells you about the qualifications for the position. Job requirements in the computer industry routinely include nonsensical requirements (5 years experience in something that's been around 3 years, 2 years experience in each of 8 items for an entry level position, etc.) This is endemic to the point where applying only for jobs where you fit the job description is a losing strategy. And even if your own job posting isn't one of those, how is the applicant supposed to know you're one of the few employers who actually means what's in the job description?
- dahart 5y agoThis is a good question. However, there is nothing that will tell you this reliably aside from employing the person. Most people who are smart and get things done will be capable of shipping code, if they can stay motivated. And that’s where having some signal about their interest can help. I want to know if people can inspire their teammates, not just get along, I want to know if they can lead by example, whether they’ll rise quickly, and whether they’ll love it for many years. The essential job functions are just plumbing, the important parts are more than that and aren’t demonstrated by evaluating for narrow, specific job skills. Look, I don’t in a million years think grinding on Leetcode is some singular answer, or even particularly good. But I don’t see anything wrong with people who are interested doing it, and I also don’t see anything wrong with asking interview questions. I never put a huge weight on such algorithm questions, and there are a dozen other major interview categories. So there’s nothing wrong with asking a few algorithm theory questions, to see the bounds of what people know. I like getting into questions that people don’t know the answer to, whether it opens a conversation about what it means, or whether the candidate has no idea or doesn’t care, that is a small amount of useful signal to me.
- eps 5y agoReversing a tree is not a skill. It's a test of rudimentary experience working with fundamental data strutures. You are not expected to know the solution, but you are expected to produce one if asked. "Leetcode puzzles"... jeez.
- mcntsh 5y agoAgain, if this "experience" so "rudimentary", why do top engineers spend time on leetcode trying to get better for interviews? Wouldn't this "rudimentary" experience be learned through their, you know, actual work experience?
- eps 5y agoBecause these "top engineers" are self-taught with massive gaps in their base CS education? Reversing a tree tests for the knowledge of binary trees and recursion, which is... what?... a second year of a CS program, conservatively?
- mcntsh 5y agoGo on Blind. There are plenty of engineers at top companies in the Bay Area talking about “grinding leet code” as a part of their job searches.
- recursive 5y agoIf playing scales were actually relevant for a professional musician, then why do they have to spend time outside of concerts practicing them in order to get better?
- TheCoelacanth 5y agoInverting a binary tree is nothing but basic pointer-chasing and recursion. Both skills that software engineers need. It's like a chef complaining about being asked to make a fried egg. They might not be making that exact food in their job, but it's trivial for anyone proficient with the basic techniques that they need in their job.
- mcntsh 5y agoI'll say it again -- if these skills were something software engineers needed, there wouldn't be a need for services like Leetcode because SWEs would just learn these skills at their jobs.
- approxim8ion 5y agoThe difficulty isn't the point. Your ability to invert a binary tree has very, very little to do with you writing CRUD applications.
- moron4hire 5y agoI see this attitude all the time. It's usually from people who don't know anything about basic data structures like trees. How would you know that they don't apply? It does apply. GUIs are fundamentally tree structures. Relational databases are fundamentally tree structures. JSON documents are fundamentally tree structures. Almost everything you're touching in a CRUD app is some kind of tree and you think knowing how to work with trees has "very, very little to do" with writing them? Again, how would you know? I'm so serious that not knowing how to invert a binary tree is ludicrously bad. It's just a swap operation. You walk the tree and you swap the left and right branches of every branch you find. That's it. It's not black magic. invert(tree): if(tree not null): temp := tree.left tree.left <- tree.right tree.right <- temp invert(tree.left) invert(tree.right) That's why it's used as an interview question. It's not meant to be a test of skill. It's a shiboleth. It's one of the easiest ways to quickly answer, "is this the sort of 'programmer' who is likely to import a whole package for padding strings with spaces?"
- krapp 5y ago>It's one of the easiest ways to quickly answer, "is this the sort of 'programmer' who is likely to import a whole package for padding strings with spaces?" But that's the sort of programmer who gets hired, because SOP for Javascript development (and oftentimes elsewhere) is to import the existing library, and any developer who insists on writing that code themselves would be considered a code cowboy wasting company time and resources, and likely writing less safe code in the process.
- dragonwriter 5y ago> How would you know that they don't apply? Because implementing low level algorithms like that is almost never an issue for application programming in modern languages, for which robust libraries for such operations exist and are data agnostic. Unless you are using Go, pretty much the only modern popular language that both features static typing and lacks generics, so that kind of algorithm re-implementation task might make some sense for screening application programmers using Go.
- recursive 5y agoWait, inverting a tree is a real thing? What does that even mean? All the terminal leaf nodes become roots? That can't be right. I thought part of the joke was that it was impossible.
- deleted 5y ago[deleted]
- eunoia 5y agoHorizontal inversion (mirror). I was equally confused though the first time I was asked lol.
- recursive 5y agoI would have called it "reversing", but I guess that sounds less technical. Now I'm confused, just in a different way. There's no obscure algorithm for this, just maybe 4 straight-forward lines, depending on language. I guess it tests whether you've ever heard of recursion. I thought the meme depended on it being some obscure, difficult, and irrelevant thing.
- moron4hire 5y agoWell, now you know. It's a meme that has become its own meta-meme.
- Arcuru 5y agoThe root is still the root, but everything else is just flipped: https://leetcode.com/problems/invert-binary-tree/ https://leetcode.com/problems/invert-binary-tree/ It is also extremely simple: TreeNode* invertTree(TreeNode* root) { if (root) { invertTree(root->left); invertTree(root->right); std::swap(root->left, root->right); } return root; }
- deleted 5y ago[deleted]
- andrei_says_ 5y agoI’ve never in my 10+ year career needed to invert a binary tree.
- moron4hire 5y agoWell, good for you. In my 20 year career, I've never not had a job that didn't eventually require me to flex my computer science degree.
- koonsolo 5y agoMost of the time the work is trivial for all developers involved. But in some special cases, some developers might reach their limit while other don't. That is my experience. And most of the time, you can rely on the Master degrees to pull through. Although I once worked with someone without a degree, but he could do magic like no other programmer I met.
- stephenhuey 5y agoNeither is counting on your fingers in binary, but would you time someone on that with a stopwatch if they would never use such a party trick during the course of a job in your company? Or perhaps we should just test their Spanish pronunciation since that would be about as relevant as inverting binary trees for any position I’ve held in 2 decades of software jobs (I’ve almost done consulting in Latin America which means my Spanish skills would be even more relevant for solving technology problems than inverting binary trees—at least for me).
- moron4hire 5y agoIf I'm hiring you to develop GUIs and work with relational databases, I'm hiring you to work on tree structures. I think you should have to prove you aren't completely clueless about tree structures. If I were hiring you to work on raw data streams, I'd expect you to be able to figure out how to count in binary on your fingers in 10 seconds, if you hadn't already figured it out while sitting around bored somewhere.
- stephenhuey 5y agoSo, I just read more about what you do, and you do some cool stuff. I know a ton of developers and most of them do nothing like what you do. The point is lots of people are annoyed at being asked interview questions about things unrelated to the job.
- moron4hire 5y agoI wasn't always a VR developer leading my own dream project, and I didn't get to be where I am by crying about "why should I know this? I don't need it for my job every single minute of every single day." You know what my first job was out of college after graduating with the highest GPA in my major? QA tester. That's all I could get. I had to beg to get commit access to fix bugs I found that I knew exactly how to fix.