"Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off."
"Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off."
Reversing a binary tree is not that difficult, and a good interviewer (specially the ones at Google) already know this, but if the interviewee shows an angry face out of frustration and doesn't ask for help or doesn't communicates his inability to proceed with such task, then what does the interviewer says? Rejection!
Interviewers also evaluate your communication skills.
Throughout my career, I have valued companies who can ascertain my skills by looking at where I've worked, code I've worked on, and the conversation we've had. Those companies seem equally adroit at determining the market and making good business decisions. Nearly every place I've worked who employs puzzle questions has either failed to maintain their market position or gone out of business. Sure, there are exceptions, but not many.
In my opinion, puzzle questions show a lack of knowledge and insight, and before starting my own company, I made it a habit to walk out of any interview that employed them.
The sole fact that people use your software doesn't mean that you're competent, similarly to your inability to work with data structures on a whiteboard not meaning that you're incompetent. Somehow people only remember about the latter part for Homebrew.
It means something else, which may actually be more valuable than being a "competent software engineer" in the eyes of a specific company.
Put another way - does being a security engineer for Equifax make you an obvious hire at Google? I mean, every American Google employee has used Equifax's credit report systems, or used a bank that uses Equifax's credit report systems - clearly, said security engineer knows what he's doing.
The author of that blog post wrote Homebrew. Thousands of engineers use it on a daily basis. That's great. I use thousands of pieces of software, worked on by hundreds of thousands of people, on a daily basis. That doesn't mean I should skip the interview process, and hire all of them. Some of those people are rock stars. Some... Are awful developers.
TreeNode* invertTree(TreeNode* root) {
if (root == NULL) {
return NULL;
}
TreeNode* tmp = invertTree(root->left);
root->left = invertTree(root->right);
root->right = tmp;
return root;
}
It sounds a lot more complicated than it is. TreeNode testRoot = new TreeNode();
testRoot.left = testRoot;
invertTree(root); // Stack overflow.
But that's not a tree, that's a cyclic graph, you may shout. That's true, but you still need to sanity-check your inputs.(I shouldn’t be arguing interview problems on HN, but I’ve had a few beers.)
Or at least to point out to the interviewer that your solution fails to handle unexpected input, and ask if they want you to add input validation logic, or if they are satisfied with the answer.
2 2
/ \ / \
/ \ / \
/ \ / \
1 3 3 1
/ \ / \ / \ / \
0 7 9 1 reverse >>> 1 9 7 0
/ / \ / \ / \ / \ \
2 1 0 8 8 8 8 0 1 2
/ \
7 7
— https://leetcode.com/problems/invert-binary-tree/description...I guess I did not spell it out in my original post, but I always felt it might have been an intentional nonsense question intended to gauge how he would react to someone talking nonsense, or something like that, and not necessarily related to technical things. A sibling post of my original to suggest this was the case, without the weird detour through the term "invert binary tree".
Edit: Of course an alternative explanation is that the interview used another term and he then used the term "invert" on twitter.
Idk, this example at least has to me always felt like people who complain about not passing the driver's test coz they did some minor error and then forgetting to mention that they drove past a stop sign.
It's really great that he made a widely used piece of software, and he's a prolific developer for it. But if he can't explain the process to how he gets to an answer, it's hard to know how he'll work with other developers on problems.
Also, I didn't realize Jonathan Blow was such an ass.
But then he reveals that he's completely full of himself when he suggests that "sorry, you're not a good programmer then."
2 2
/ \ / \
/ \ / \
/ \ / \
1 3 3 1
/ \ / \ / \ / \
0 7 9 1 reverse >>> 1 9 7 0
/ / \ / \ / \ / \ \
2 1 0 8 8 8 8 0 1 2
/ \
7 7[1] https://leetcode.com/problems/invert-binary-tree/description...
This problem was inspired by this original tweet by Max Howell
There are many definitions of invert. This is relying on one definition that is jargon, and not widely agreed upon jargon at that.For a two or more dimensional “object”. Invert means to reorient the top and the bottom, while reverse swaps the left and the right.
The two only might mean the same thing with one dimensional data structures. For instance inverting a line of text might (ambiguously) mean reversing it. Or drawing it upside down. Or upside down and backward. But at least you would expect a clarification.
In the interviews I did with Google, Facebook and others (mostly for fun, not profit) if I didn't know an algoithm from top of my head I typically could talk to the interview and discuss th problem and they'd point me in the direction. Sometimes those interviews are less about being able to remember the thing, but the thought process to get there.
Aside from that: Google clearly optimizes on not hiring too many bad people, but rather leave a few good candidates behind.
> if you build a dependency management tool like brew
> and don't know what a tree is, this is suspicious
They didn't say that they didn't know what a tree is. They said they couldn't invert a binary tree in the interview.It's a stretch to start suggesting that someone doesn't know their basic data structures because they failed some riddleware on the spot.
You can say that they aren't what google was looking for, but my problem comes when someone tries to dismiss another as a bad developer because of that.
If one doesn't know what is meant one can talk to the interviewer and get a hint about what is meant. It can be that the interviewer is bad and misleading, but usually they have some specific training, this seems unlikely as the candidate didn't complain about the interviewer but admitted he had no clue.
The follow-up question would probably be the question about the complexity, that is also trivial f you know fundamentals of big O notation, as one has to walk over each node.
It's hard to find a more trivial algorithms question. Algorithms are fundamental knowledge for programmers (other than script kiddies)