Getting stuck in a technical interview happens to the best of us. In the Google interview, that happens by design. A good technical interview will test how well you can apply what you know to situations you’ve never seen. As a Google engineer, you will often run into problems that don’t have clear solutions up-front. These challenges need good problem solving technique and the courage to follow through.
Getting stuck in the middle of a high-stakes interview might be your worst nightmare. Don’t fear! Allow me to share five tips that will help you get unstuck in no time.
1) Let your interviewer know
The single most important thing you can do when you get stuck is be honest and admit it to your interviewer. Besides, it’s not like your interviewer won’t be able to tell. They have likely seen countless other candidates get stuck at the same point. Pretending that you are not stuck will only come off as deceptive or dishonest. Besides, a good interviewer is there to help you in these moments.
Don’t just say your stuck and sit there waiting for your interviewer to give you the answer. Be specific about where you are stuck and talk about possible paths you’ve pondered. Make it clear that you are not giving up. Keep grinding towards a solution.
2) Ask more questions
Often, you will get stuck if you are missing the necessary information you need to solve the problem. This is an easy to remedy. Ask more clarifying questions. If you have a hard time thinking of more questions to ask, consider working through more examples. Review any assumptions you have made about the problem and double-check their correctness.
Your practice regimen should include practicing how to ask lots of good questions. If you’re not good at doing this, then use my six-point strategy for tackling technical interviews. Practice makes perfect.
3) Simplify the problem
It is helpful to tackle a complicated problem in simpler, manageable parts. For instance, suppose that you needed to search for an element in an infinite array that doesn’t have a length. It might be best to start by solving the problem for a finite array at first. Then, think about how you would change the code to handle the infinite case. For memory scalability problems, first handle the case where everything fits in memory. Then, think about how you would change the solution to handle the case when the input doesn’t fit.
Many interviewers will break up interview questions into phases. This is to help you work your way up to the complicated case. But feel free to do this on your own, if necessary. Make sure to tell your interviewer and listen to any feedback they provide.
4) Leverage guiding principles
When stuck, think about guiding principles that will help you move forward. These are principles you learn as a result of practicing a variety of sample problems. Here are some guiding principles for coding challenges:
- Space-time tradeoff. If you want to make something fast, you usually need to use more space, and vice-versa. Is there a data structure that you can leverage to help you out? Hash maps and hash sets are my go-to data structures. They are very versatile for solving a variety of problems. Use memoization to prevent having to re-evaluate sub-problems you’ve already solved.
- Think graphs. Tons of problems are expressible as graphs. People don’t often think of them this way unless they hear key works like “relationships” or “paths.” Ask yourself: is there is a specific kind of tree or graph algorithm that would make the problem easier to solve?
- When doing recursion, remember backtracking and memoization. Practice plenty of recursion problems to ensure that your comfortable writing recursive code. It takes some getting used to, but it gets easier with time.
5) Think of similar problems and their solutions
If you have practiced well, then chances are you’ve encountered a similar question. That is great because you can draw from prior lessons learned. Besides, many interview questions are variations of existing questions with terminology mixed around. Use this fact to your benefit. Does the problem you’re trying to solve sound familiar? What similarities and differences can you draw?
Smart people are good at leveraging prior knowledge in new contexts. Draw from your experience and expertise. Trust your instincts. Even if you don’t think you are good at this now, you can get better by—say it with me—practicing.
Image copyright : atic12