Authors: Gayle Laakmann McDowell
Tags: #Business & Economics, #Careers, #Job Hunting, #General
Develop a Rule or Equation
When you get a problem, see if you can work through examples. Try to formulate any rules or equations that you discover along the way as specifically as possible.
Simplify the problem
Sometimes simplifying a problem or solving the problem for a specific case can help illustrate a general trend.
Examples
Answering the Tough Questions
Sometimes, the toughest questions are the ones we already know and don’t want to answer. Maybe it’s a layoff, maybe it’s a pattern of job hopping, or maybe it’s a sudden career switch. No matter how much we don’t want to get these questions, we must be prepared for them. Practice your story for this, both to yourself out loud and to your friends. Does it appear honest and credible? Are you prepared for any follow-up questions that your interviewer might ask?
The biggest mistake you can make in this question is brushing off the question. Your interviewer may not press you for your answer, but she won’t be impressed.
Whatever you’re trying to hide, be honest and don’t assign too much blame away. Admit your mistake, and focus on what you’ve learned and how you’ve grown since then. This sort of answer will show maturity and honesty, while leaving your response on an honest note.
Layoffs
If you were let go during a round of layoffs, you’re in a better position than many. However, even these routine layoffs might raise a red flag: some people are usually kept—why weren’t you?
The important thing is to stress evidence that you were performing well:
Being Fired
Interviewers know that there are two sides of the story. If you claim it’s not your fault that you got fired, they’ll just dig elsewhere and discover the truth eventually. It’s better if it comes from you.
Accept the blame, and show what you’ve learned from it:
Offer a crisp and concise answer. Don’t play the blame game. Don’t bad-mouth your former employer. And don’t lie.
Unemployment
If you’ve been unemployed for an extended period of time, interviewers may want to know what you have done during your time off. “Looking for a job” is probably not a complete answer. How many hours a day could you have really spent doing that?
The best answer involves accomplishing something or brushing up on new skills. I recall one man I interviewed who had a seven-year gap (!) in his career. He explained to me that he had taken time off to raise his two young children. Once they started preschool, he spent his day writing a few games and small pieces of software. This candidate spun what was initially a red flag—an extended career gap—into a big plus. Many of us write software for pay, but writing software for fun shows a unique passion for the field. He was hired.
If you’re currently unemployed, find something to do that’s productive. Can you help out your friend’s start-up? Can you take some classes at a community college? Unemployment is an excellent time to beef up your résumé.
Your Questions Answered
Barrier to Entry
Dear Gayle,
I’ve lived most of my life in India, before relocating to the United States, and still have a very thick accent. This isn’t as much of an issue for technical questions, but I have trouble maintaining a conversation with my interviewer on behavioral questions.
If my interviewer is from a country other than India or the United States, this issue is exacerbated. Is there any way to request specific nationalities of interviewers?
~G. E.
Dear G. E.,
You can’t ask for specific nationalities and, even if you could, what would that say about you? No one wants to hire someone who can work only with specific nationalities.
Instead, I’d work on how you communicate. Speaking more slowly and using simpler words can help with comprehension.
In the long run, however, you might want to think about speech classes. Many people have reported a lot of success with improving their pronunciation in this way. This would not only help your job search, it would also help your career.
~Gayle
It’s a Numbers Game
Dear Gayle,
While I understand the basic approach of estimation questions, I always seem to make mathematical mistakes. I’m just not good at math in my head. Can I ask for a calculator, or is there anything else I can do?
~W. P.
Dear W. P,
You probably can’t ask for a calculator, but there are ways that you can get better at these questions, especially since you say you have the approach down.
Many people face difficulty with doing math in their head because they just can’t hold so many different numbers at once. As soon as the number 293 comes up, the number 143 gets lost. It may be helpful to ask for a sheet of paper to jot down numbers as you go.
Another trick that may help you is to keep your notes well structured. You might be periodically pulling from the wrong number on the page, causing you to wind up with a wildly inaccurate number.
Finally, memorizing common arithmetic “equations” can be useful. You hopefully have the multiplication tables up through 12-times-12 memorized, but you should memorize up through 20-times-20. Make sure you really, really know them—it’s an easy way to improve your results.
~Gayle
The Great Unknown
Dear Gayle,
In a recent interview, I was asked to design a social network for the elderly. I’ve never used Facebook or any other service, so I didn’t know how to answer this question. I explained this to my interviewer, but she just shrugged and asked me to do it anyway.
Isn’t this sort of unfair? How was I supposed to handle this question?
~C. R.
Dear C. R.,
In this situation, it was probably a good idea to explain to your interviewer that you had never used a social networking web site. This way she would understand if you made an unusual assumption. However, at that point, your interviewer made the determination that she wanted to hear your answer anyway. She will take into account your situation as necessary.
Your lack of familiarity could either help you or hurt you—it depends on how you take it. If you stomp your foot or act unhappy, well that will really hurt you. After all, in life, sometimes we get asked to design an application we’re not familiar with.
In those cases, how do we proceed? We figure out what the needs are. And here’s where the potential advantage comes in.
Because you’re not familiar with Facebook, you won’t be thinking about events or status feeds or “like” buttons—items that were designed with a different user in mind. You’ll be solely focused on what elderly people care about: their grandchildren, their health, and maybe some TV shows and news. This means you’ll want to make it easy for people to send pictures to them. Maybe they’ll want to connect with their doctors, too. Catch recaps of TV shows. Read short news summaries.
When in doubt, most interview questions can be answered by pretending it’s a real-life situation. In the end, that’s what interviews are designed to simulate.
~Gayle
Additional Resources
Please visit
www.careercup.com
for additional interview questions and resources.
If you’re applying for a software development position, you’ve got a special set of skills to prepare. Yes, you’ll be asked to code. No, you don’t get a computer—just a whiteboard, or sometimes just a sheet of paper. Whiteboard and interviewing coding requires a special set of skills. Even the best coders can get nailed on coding questions.
A software development interview consists of about 15 minutes of discussion, which usually includes some questions about your résumé and/or offers you a chance to ask the interviewer questions. The bulk of the interview is spent on coding and algorithm questions.
Coding questions can be very quick, but will often take up the full interview time. You’re not expected to be a flawless coder. Most questions are tricky enough that even the best candidates make a few mistakes.
How They Differ: Microsoft, Google, Amazon, and Apple
I can’t tell you what each company will ask—after all, each interviewer basically does whatever he or she wants. However, certain companies have trends.
How to Prepare
When it comes to practicing interview questions, quality matters more than quantity. There are literally thousands of sample interview questions online for companies like Google, Microsoft, and Amazon—don’t try to memorize the answers. It’s impossible and won’t help you anyway!
The Five-Step Approach to Effective Preparation
Take your time solving problems, and try the following approach in practicing questions:
1. Try to solve the problem on your own.
I mean,
really
try to solve it. Many questions are designed to be tough—that’s OK! When you’re solving a problem, make sure to think about both the space and time complexity. Ask yourself if you could improve the time efficiency by reducing the space efficiency.
2. Write the code for the algorithm on paper.
You’ve been coding all your life on a computer, and you’ve gotten used to the many nice things about it: compilers, code completion, and so on. You won’t have any of these in an interview, so you better get used to it now. Implement the code the old-fashioned way, down to every last semicolon.
3. Test your code!
By hand, that is. No cheating with a computer!
4. Type your code into a computer exactly as is.
Rerun both the test cases you tried and some new ones.
5. Start a list of all the mistakes you made, and analyze what types of mistakes you make the most often.
Is it specific mistakes?
You can find thousands of coding interview questions on
CareerCup.com
that candidates have gotten from companies like Google, Microsoft, Amazon, and other major tech companies.
What If I Hear a Question I Know?
In offering thousands of sample interview questions on
CareerCup.com
and in my other book,
Cracking the Coding Interview
, my goal is not to help you memorize questions and then regurgitate answers in an interview. Interviewers want to see how you approach problems, so spitting out pre-prepared solutions won’t do you much good.
If you get a question you’ve heard before, tell your interviewer! It’s not only the
right
thing to do; it’s also the smart thing. If you try to hide it and pretend to fumble through the answer, your interviewer will probably be suspicious—and lying (or hiding the truth) is perhaps the worst thing you could do in an interview.
However, if you are honest and say that you’ve heard the question before, you’ll win major bonus points. Interviewers care about honesty, even if there’s usually no way to directly test it.
“Must Know” Topics
Most interviewers won’t ask you about specific algorithms for binary tree balancing or other complex algorithms. Frankly, they probably don’t remember these algorithms either. (Yes, that means you can put down the CLRS algorithms book.)
You’re usually expected to know only the basics. Here’s a list of the absolute must-know topics:
This is not, of course, an all-inclusive list. Questions may be asked on areas outside of these topics. This is merely a “must know” list.
Data Structures | Algorithms | Concepts |
Linked Lists | Breadth First Search | Bit Manipulation |
Binary Trees | Depth First Search | Singleton Design Pattern |
Tries | Binary Search | Factory Design Pattern |
Stacks | Merge Sort | Memory (Stack vs. Heap) |
Queues | Quick Sort | Recursion |
Vectors/ArrayLists | Tree Insert/Find/etc. | Big-O Time |
Hash Tables |
For each of the topics, make sure you understand how to implement/use them, and (where applicable) the space and time complexity.
Practice implementing the data structures and algorithms. You might be asked to implement them directly, or you might be asked to implement a modification of them. Either way, the more comfortable you are with the implementations, the better.
Memory Usage
As you’re reviewing data structures, remember to practice computing the memory usage of a data structure or an algorithm. Your interviewer might directly ask you much memory something takes, or you might need to compute this yourself if your problem involves large amounts of data.
Many candidates think of their algorithms on only one dimension—time—but it’s important to consider the space complexity as well. We must often make a trade-off between time and space, and sometimes, we
do
sacrifice time efficiency to reduce memory usage.
Coding Questions
Interviews are supposed to be difficult. If you don’t get every—or any—answer immediately, that’s OK! In fact, in my experience, maybe only 10 people out of the 150+ that I’ve interviewed have gotten the algorithm right instantly, and all but one of them made later mistakes on the coding.
So when you get a hard question, don’t panic. Just start talking aloud about how you would solve it.
And, remember: you’re not done until the interviewer says that you’re done! What I mean here is that when you come up with an algorithm, start thinking about the problems accompanying it. When you write code, start trying to find bugs. If you’re anything like the other 110 candidates that I’ve interviewed, you probably made some mistakes.
1. Ask your interviewer questions to resolve ambiguity.
2. Design an algorithm.
3. Write pseudo-code first, but make sure to tell your interviewer that you’re writing pseudo-code! Otherwise, he/she may think that you’re never planning to write “real” code, and many interviewers will hold that against you.
4. Write your code, not too slow and not too fast.
5. Test your code and
carefully
fix any mistakes.
Let’s go into each of these in more detail.
Step 1: Ask Questions
Technical problems are more ambiguous than they might appear, so make sure to ask questions to resolve anything that might be unclear or ambiguous. You may eventually wind up with a very different—or much easier—problem than you had initially thought. In fact, many interviewers (especially at Microsoft) will specifically test to see if you ask good questions.
Good questions might be things like: What are the data types? How much data is there? What assumptions do you need to solve the problem? Who is the user?
Example: “Design an Algorithm to Sort a List”
Answer:
An array.
Answer:
Numbers.
Answer:
Yes.
Answer:
They are the ages of customers.
Answer:
About a million.
We now have a pretty different problem: sort an array containing a million integers between 0 and 130 (I don’t think people are living past age 130, are they?). How do we solve this? Just create an array with 130 elements and count the number of ages at each value.
Step 2: Design an Algorithm
Designing an algorithm can be tough, but our five approaches to algorithms can help you out. While you’re designing your algorithm, don’t forget to think about:
Step 3: Pseudo-Code
Writing pseudo-code first can help you outline your thoughts clearly and reduce the number of mistakes you commit. But make sure to tell your interviewer that you’re writing pseudo-code first and that you’ll follow it up with “real” code. Many candidates will write pseudo-code in order to “escape” writing real code, and you certainly don’t want to be confused with those candidates.
Step 4: Code
You don’t need to rush through your code; in fact, this will most likely hurt you. Just go at a nice, slow methodical pace and remember this advice:
Step 5: Test
Yes, you need to test your code! Consider testing for:
If the algorithm is complicated or highly numerical (bit shifting, arithmetic, etc.), consider testing while you’re writing the code rather than just at the end.
When you find a mistake (which you will), relax. Almost no one writes bug-free code; what’s important is how you react to it. Point out the mistake, and carefully analyze why the bug is occurring. Is it really just when you pass in 0, or does it happen in other cases, too?
I remember one candidate who was implementing a binary search tree method getSize(). When he realized that his method returned “3” on a two-element tree, he quickly appended a “+ 1” to the return statement. Maybe he thought I wouldn’t notice. A few moments later, he discovered his algorithm branched left in one case instead of right. So he flipped the left and right. Pretty soon, his code was so littered with little changes that it was unrecognizable; he had to start over from scratch.