Cracking the Coding Interview has been one of the best selling books in computer science for a few years now, and for a good reason. It covers almost 200 coding questions on common interview topics, and each question has at least one detailed solutions.
The topics include:
- Linked Lists
- Bit Manipulation
- Logic Puzzles
- Object-Oriented Design
- Dynamic Programming
- System Design and Scalability
- Sorting and Searching
Working through these questions will give you a solid foundation to stand on for your future coding interviews. In the beginning of each chapter you are also given a brief background and theory of the specific topic. Should you be struggling with any question, you can always read the hints, which are there to simulate the help you probably would get from an interviewer. If you are able to answer all these question in an acceptable manner, you can be confident you won’t make a fool out of yourself on your future interviews. Of course, this book never goes into extreme depth on any of the topics, so you should know more about the specific area you are interviewing for.
When you are on a coding interview you should remember these things:
- There is often both intentional and unintentional ambiguity in the questions you are asked. Ask the right questions to make sure you are solving the correct problem. You should also ask any questions (like the purpose of the application), where the answer may affect how you choose to implement the solution. This gives you something to argue with when you are inevitably are faced with some kind of trade-off.
- Think out loud! It is very difficult for the interviewer to follow your process if you don’t tell them what you are doing. It is also difficult to know if you are stuck or if you are just thinking and making progress, if you don’t do this. Maybe you are stuck on some insignificant part, which your interviewer can help you with.
- Write clear code! This is something you should always do, but it is especially difficult on a whiteboard, where you can’t easily move things around. Be extra careful and try to create methods early.
- Don’t write every single line of code. Many times a clear method name without implementation is enough. Focus on the important things.
- Discuss trade-offs of the solution that you have provided.
- Test your solution in an appropriate way.
On top of this, the first chapters of the book contain general tips on less technical things. For example how to prepare for interviews months and years in advance, get the right experience, write your resume, and handling offers and rejections. There is one chapter dedicated to behavior questions, where different types of answers are analysed and proposed. If you like this part, you should probably read the authors other book Cracking the Tech Career, where she expands on all these topics.