3 ms·
So a lot of the more complicated DS&A questions seem ridiculous, but I had to check on "inverting a binary tree" to see if it was really as simple as it sounded
by andrewflnr 5y ago
So a lot of the more complicated DS&A questions seem ridiculous, but I had to check on "inverting a binary tree" to see if it was really as simple as it sounded. It is. Just swap left and right, recursively. It's one of the easiest possible tests of being able to grok recursion[0]. You should be able to do this, even if you're self-taught or early in a college degree program.
Am I missing something? The only excuse I can imagine is interview anxiety, which is a real problem that deserves accommodation (bad explanations of the problem may play a role too, but you should be able to ask good clarifying questions). But if someone is really incapable of this very minor feat of programming, then I'm sorry but an interview process is right to reject them.
[0] Even if you don't literally write recursive Java methods, which you probably shouldn't, understanding recursive logic is critical all over the tech stack.
- dgs_sgd 5y agoI agree with this. But asking the candidate to invert a binary tree is one thing and asking the candidate to flawlessly solve back to back leetcode "hard" level problems is another. I think the latter is mostly what people lament, where you end up doing so much prep that it boils down to "I've seen this one before" and you proceed to regurgitate what you memorized.
- andrewflnr 5y agoMy point is that people lament the latter while using the former as an example. This makes everyone dumber.