If you’re interviewing for a software engineering position nowadays, one of the first steps in the interview process will be a phone screen. You and the interviewer will look at the same source code using a collaborative code editor like Coderpad. As an engineer for five years and a Hackbright mentor, I’ve been on both sides of the phone. Here’s my big-picture strategy for tackling these interviews, and some advice from experience.
Problem solving is messy. Embrace it!
“Are you going to charge in empty-handed, or carry a sword and a spool of string?”A good interview question will have a solution that isn’t immediately obvious — one that you aren’t expected to know or recognize immediately. Instead, you discover the solution by identifying and solving smaller subproblems, evaluating multiple approaches, and backtracking from failed attempts. Sometimes you’ll need to make a logical leap, and other times you’ll need to make incremental improvements.
Think of the interview as a labyrinth. There’s an unavoidable component of chance involved, but you can maximize your odds of success by having a strategy beforehand. Are you going to charge in empty-handed and hope for the best, or are you going to carry a sword and a spool of string?
Five Steps to Success
1. Work some examples manually
Don’t immediately start writing code. There are two good reasons:
- You want to make sure your understanding of the problem matches the interviewer’s. Try to think of edge-case examples. For example, do you and the interviewer agree on what number the Fibonacci sequence starts with?
- If you can’t do something manually, you can’t automate it.
The coding questions that you’ll get in phone screens are usually some form of “given this input, produce this output.” Work out a simple example. Then work out some harder ones. Think about edge cases in the input. What if the numbers were negative? What if the integers were real numbers?
2. Translate your examples into test cases
After you’ve worked through a few examples, you’ll develop an intuition for what inputs make the problem easy to solve, and what inputs make it difficult. The solutions for the harder cases tend to build on those for the easier ones, so you’ll arrive at a complete solution more quickly if you start by solving the simple cases. Get familiar with your language’s assert library so that you can quickly translate your worked examples into test cases.
3. Start working on a solution
Run your code against your test cases frequently. Get them to pass, one by one. This has two benefits:
- You’ll demonstrate progress as each test case passes. The interviewer gets to see you methodically tackle a problem rather than flail around. Plus it’s good for your morale.
- Should you cause an old test case to break — a regression — you’ll know immediately. That’s when the problem is easiest to fix.
4. Look for ways it won’t work
Once all your test cases pass, think of any other edge cases you may have missed. You have a better understanding now of the problem and the solution, so you may come up with situations where your code won’t work. If you do, go back to step 3. Your interviewer will be impressed with how careful you are, and how readily you admit to discovering flaws in your code.
5. Refine it
“Your interviewer will be impressed with how readily you admit to flaws in your code.”Once you’re confident that your solution is behaving correctly, it’s time to refine it; it’s rare to arrive at the optimal solution for a non-trivial problem on the first try. Analyze your solution’s time complexity, and see if you can do better. Common strategies for improvement are pre-sorting the input, using a special data structure, or using dynamic programming. Use your improved understanding of the problem to simplify your code — an elegant recursive solution might be obvious only in hindsight.
If you get a practical problem — like discovering the primary color of an image — you should talk to the interviewer about how you would operationalize your solution. In other words, what do you need to do before you can ship this code? Common topics are security, performance, scalability, testing, and documentation. For example, will your code work on extremely large input? What if a user uploads a Word document when you expected a jpeg image?
Challenges unique to phone interviews
The interviewer can’t see you
This makes it hard for them to gauge your progress. To combat this, you need to over-communicate what you’re doing, whether that’s talking or typing. Whenever possible, show your work in the collaborative text editor. But sometimes, you’ll get a problem that’s very graphical, and easier to think about on paper. For example, it’s far easier to draw a tree and work out a recurrence relation on paper. Tell the interviewer that’s what you’re doing, so they don’t think you’re spinning your wheels.
You can’t see the interviewer
No vision means you’ll be extra-sensitive to everything you hear. Don’t over-react to it.
- If you hear typing, it’s not because they’re chatting with their friends or working on something else. A good interviewer will be constantly taking notes; they want to capture exactly what you say and do, so that they can make an objective decision later.
- If you hear a sigh, it’s probably not because of you. Your interviewer may have received an email that their lunch order was delayed.
- If you don’t hear anything, it’s because they’re giving you quiet time to think. Don’t presume silence means they’ve written you off.
Using the environment
Run your code often
Frequently make sure that your code compiles, and that your solution is behaving as expected. Unlike a whiteboard interview, you can actually execute code. So do it, and do it often. Very often — several times a minute isn’t uncommon. It’s a rookie mistake to write a large amount of code and then try to get it working at the end.
Got all that?
“As an engineer it’s not just whether you solve a problem, it’s how you do it. Collaborative coding interviews are a unique opportunity to showcase your technical skills. Don’t be intimidated by the stranger watching your every keystroke. Instead, practice the five-step strategy so you can methodically tackle difficult problems under pressure. Before your interview, refresh yourself on the challenges unique to phone screens, so you’re mentally prepared for what’s to come. Finally, don’t forget to use the environment to your advantage, by frequently running your code as you’re working on it. You’ll be a winner, because as an engineer it’s not just whether you solve a problem, it’s how you do it.
- Admissions Office (10)
- Alum (30)
- Alum News (38)
- Blog (72)
- Career Services (10)
- Courses (9)
- Diversity (9)
- Engineer Advice (14)
- Engineering Advice (15)
- Hackbright Field Trips (24)
- Hackbright Mentors (14)
- Hackbright News (82)
- Hackbright Speakers (18)
- Hackbright Video (9)
- HackbrightPRO (1)
- Profiles of Woman Engineers (52)
- Recruiting & Hiring (4)
- Recruiting & Hiring (6)
- Resources (10)
- Student Blogs (16)
- Tech (11)
- Tech Talks (4)
- Thought Piece (3)
- Uncategorized (21)
- Welcome (4)