There you stand, alone staring at a whiteboard with the hiring manager standing behind you.
They ask you to solve a problem you’ve never seen before.
Have you ever had the experience of freezing after being given a particularly hard problem?
This is common for engineers (myself included) and the reason for this is something called an Amygdala Hijack, one of the many blockers we talk about during Outco. In short, this is when the fear center of the brain takes over higher functions of the brain and prevents us from being able to think clearly and effectively problem-solve.
The technical interview is one of the most grueling parts of an engineers job search.
You have to be ready to answer any question - whether you’ve seen it or not, but there’s a hidden gem you can utilize to make any question easier to answer.
What is that, you might ask? The simple act of asking a question.
How to Utilize Questions Effectively
After being given the prompt to any problem, start by asking questions about it. It doesn’t matter if you’re just working on the problem by yourself or if an interviewer is asking you.
This is all about establishing an understanding of the problem, and to constrain your thinking about it.
Start by Asking Yourself Some Questions
Does this look like a problem you’ve seen before?
What do you remember about similar problems?
What immediately stands out about it to you?
Begin to think through time and space constraints. Knowing this will help you rule out solutions that run too inefficiently, or it will give you a hint of how many auxiliary data structures or loops you need.
Interview Questions About Arrays
If you have an array, for example, ask if it’s sorted.
Does it contain only numbers?
Are those numbers integers?
Can they be negative, or just positive?
Ask if there is a max length, or range of input sizes.
Interview Questions About Strings
For strings, ask if there is a distinction between upper/lower case.
Are there spaces?
Is there punctuation?
Ask about edge cases, like empty strings, empty arrays, very large or very small inputs etc.
Asking Language Specific Questions
Can you use certain libraries?
How should you handle errors?
What kinds of inputs should your function handle?
Asking Questions in a Pair Programming Situation
Try to figure out what other guarantees there are in the problem.
Again, it’s all about putting constraints on your thinking and finding parameters that will focus your attention towards a smaller solution space.
What if the Interviewer Doesn’t Give You An Answer?
Keep in mind time and space complexities might not always be given. They might just say ‘do the best you can.’
This shouldn’t deter you, but it also means there could be several ways to solve this problem, and some are better than others.
The point is that there are a ton of conditions and constraints that will help focus your thinking and can hint at the direction you need to go in.
At the most basic level you are gathering data.
With all this said, keep this portion of the interview short, maybe just a couple minutes of discussion or thinking.
Don’t frame it as you looking for hints. Frame it as you trying to understand the problem better.
Also remember you can ask questions later on as they come up, so don’t stress about trying to nail EVERY constraint now.
In summary, asking questions is all about gathering more information making sure you are solving the correct problem.
It would shock you how often people start solving different problems than the one I asked, all because they didn’t clarify what they were supposed to be doing.
Let’s use an example to practice.
The Tower of Hanoi Problem