It's a challenge to outperform all the other candidates in a competitive tech job only, but there is hope. You can improve your performance with practice and watching out for these gotchas:
- Make absolutely sure you are solving the right problem: I ran into this the other day. It is entirely a communication issue. When doing an initial screen over the phone, this problem is compounded. For example, maybe an interviewee is hacking out a function that returns the k highest priced products when the interviewer is expecting the kth highest priced product. One can squander a lot of time due to these misunderstandings. A good interviewer will try to guide you back to the right path, but you can't expect this. Be sure to ask questions. Confirm that the input and output are exactly what you expect. Use examples.
- Don't ever give an interviewer the impression that you are avoiding writing real code. This is an impression thing. This is a coding interview so you should be expecting to write code. Get down to it with confidence. Give the impression that you love writing code because that is the job you are applying for.
- Try to avoid spending too much before communicating what you are thinking. Sure, it requires time to think about problem and approach. The interview should understand this. But as an interviewee, you need to let the interviewer know that you aren't entirely stuck. Even if you are, let the interviewer know what you are thinking.
- Don't get stuck on a single data structure that you try to use for all problems. If the data structure you are using isn't getting you the running time or space complexity you want, take a step back. Consider a different choices for data structures. Consider whether using a couple of data structures in concert might solve the problem better.