Why you failed your tech interview #2 - You messed up your details | FizzBuzzed
Details matter. Getting details wrong and being careless during interviews leads to a lot of failed interviews (that probably should have been passes). In the real world, completely incorrect code can be better than code with subtle bugs. If your code is completely broken, you'll notice with test cases and fix it. If you have subtle errors, the code will likely get through code review and lead to a long and difficult debugging session.
We all make mistakes, but why do some programmers seem to make fewer than others? Are there any tricks you're missing that could help you get the details right?
Here's a classic whiteboard interview gone bad:
Interviewer: "Could you please code (some simple algorithm, binary search, bfs, etc)"
Candidate (after writing some code): "Ok, that should do it."
Interviewer: (squinting at the code): "Hmm well what about this test case?"
Candidate: *Traces what the code would do for the test case and realizes a bug.* "Oh… well let me just fix that."
A small piece of code is scribbled out and changed. The test case now passes…
Interviewer (squinting again): "Hmm well what about this other test case?"
Candidate: *Does some more erasing. Adds another scribble* "Here, now that test case will pass too!"
This 'test case and scribble' pattern continues a few more times until the candidate's code looks nothing like originally intended. The interviewer records the code as written and eventually forwards it to a hiring committee. The hiring committee has only this code as evidence to judge the candidate's ability and assumes the candidate codes spaghetti.
The candidate is rejected.
How can you avoid falling into this trap?
Here are a few techniques that can help you get your code correct the first time:
Read full article from Why you failed your tech interview #2 - You messed up your details | FizzBuzzed
No comments:
Post a Comment