Skip to main content

Acing the Coding Interview

If you’re a computer science / information systems / computer engineering student, or if you’re working as a software engineer / developer / programmer, chances are that sooner or later you’re going to run into a coding interview: you’ll be given a problem and will be expected to solve it, face to face. Even if you can write great code, there are a few things you can do to increase your chances of impressing an interviewer. While different companies use a variety of styles, here’s some advice that should apply generally.

Before the Interview

Read up on the company and the position before you walk in the door. You don't have to go crazy - a few minutes spent searching the web can give you good results here. Find out about the languages and technologies they use - if you know some of them, leverage your strengths here. If you don't, try to fill the gaps as much as you can before the interview. You might not be able to learn everything you don't know by the interview, but learning even just a little can go a long way - it demonstrates your interest in the job and shows you're willing to learn new things.

Understand common data structures. You should know how common ones work, and what they're useful for. It's good to know lists, hash tables, and binary trees, and how to use them to solve problems - they come up a lot in coding questions. Brush up before your interview if you don't remember them.

Review Big-O notation. You should be able to evaluate your code and talk about your thought process. It's reasonably common for an interviewer to ask you to analyze the computational complexity of your solution.  

Know some sorting algorithms. It's important to be able to explain at least one sorting algorithm; insertion sort and merge sort are pretty good ones to know. It's definitely good to be able to write the code for those - try to find some solutions in your chosen language or the language you'll need to use and practice them. More than once I've had interviewers simply ask me to write a sorting algorithm, so a little preparation here might really help you in the interview.

Practice. One of the most important things you can do (and one thing that many candidates skip) is practice; so many candidates spend years honing their technical skills but won't spend an hour to practice their interviewing skills. An easy way to do this is to find a friend and ask each other technical questions. Even if it's a question you already know the answer to, it's definitely useful to practice articulating the answer and explaining your solution. Project Euler and Google CodeJam are good places to start for practice questions.

Be prepared to write code a few different ways. Some companies will let you use a laptop, some ask you to scribble a solution on paper, and some will have you write it out on a whiteboard. Make sure you can solve the problem with any of those... you don't want the first time you solve a problem on the whiteboard to be in front of the interviewer.

Before You Answer

Pick the right language. The interviewer might ask you to use a specific language, but if he or she doesn't, make sure the language you want to use is OK. If you're most comfortable with one particular language, use that one if you can. Don't try to get adventurous and attempt to answer questions in a language you're just starting to learn - put your best foot forward here.

Ask questions. It's important to ask lots of questions to make sure you understand what the interviewer is looking for - don't make assumptions without verifying them (even small things). Approaching a problem the wrong way can really derail your solution, and missing some small details can invalidate your whole approach. Make sure you're on the same page with the interviewer.

Answering the Question

Communicate. After you've been asked a question, talk through your thought process and communicate with the interviewer. If you need a minute to think, just tell the interviewer that. The interviewer can't read your mind - keeping an open line of communication will help the interview flow. If you get stuck, explain why you're stuck. It might help you figure out your problem, or it might prompt the interviewer to give you a hint - either way, keep communicating.

Draw a picture if you need to. Sometimes it helps to draw pictures or sketch out a solution before starting to write code - drawing a picture can help to make sure that you and the interviewer are on the same page about expectations. If you're still not sure how to start, write down some test inputs and explain how you'd approach the problem for them - that might help you to find the right way to code the solution.

Brute force isn’t always bad. If you're not confident about coming up with an optimal solution for the question, it might be a good approach to start with a brute force approach and iterate to improve it. Even if you don't know an elegant solution immediately, you'll at least have something to show if you start with the obvious solution.

Keep an eye on the time. Don't rush if there's still a while before your interview is over - pace yourself. Let your interviewer prompt you if there are unknown time constraints.

After You Answer

Be ready to ask your interviewer a question or two. If you do a bit of research about the company you're interviewing with you should be able to come up with some questions, but here are some ideas if you don't come up with anything:
  • Is the question you just asked a typical problem you solve here? How is the real job different?
  • What's your favorite thing about working here?
  • What's a typical day like in your role?
  • What's something about your job that bothers you regularly?
  • What about your current role has helped you grow in your career?
  • Other than this company, what other companies are you interested in?
  • If I ultimately want to do ______, how might this job help me do that?
  • What's the hardest problem you're facing right now?
Make sure you thank your interviewer for their time. It's a formality, but one that's noticed (especially if you skip it).



watch my videos on youtube follow me on twitter view my pictures on instagram view my profile on linkedin view my google+ profile

Comments

Popular posts from this blog

Sheetz Sandwich Standoff: El Gringo vs Twisted Swiss

My wife left me alone for dinner tonight so I decided to check out the latest GetGo offerings... but to my great chagrin, they have no promotional subs. My travels led me to the local Sheetz, where I'd be able to keep eating the best gas station sandwiches around. To keep tradition alive, I picked the two most outrageous "Burgerz" on the menu: El Gringo and Twisted Swiss. The ingredient list is promising: Twisted Swiss is the burger with topped with swiss cheese, cole slaw, pickles, bacon, and whatever "Boom Boom Sauce" is on a pretzel bun.  El Gringo is the burger topped with pepper jack cheese, chili, Doritos, and BBQ sauce on a regular old bun. I unwrapped them both and stood back to admire the majesty before me. They're not pretty, but they do look a lot better out of the wrapper than many fast food burgers I've eaten. Twisted Swiss I expected this sandwich to be an awful mess.  It just seemed like a bunch

The Gobbler from Arby's

Stop.  Stop what you're doing and go to Arby's. Right. Now.  Have them make you a Gobbler .  This is not something you'll regret. Go. Eat this thing. Look at that bacon. Go. Arby's has a new sandwich.  It's called "The Gobbler" and as far as I can tell it's two things: a vehicle for their new deep fried turkey, and an attempt at a Thanksgiving themed sandwich.  It's also a third thing: magically delicious. move over Lucky, there's a new holiday mascot on the block Unwrapping: this actually looks like a sandwich.  It looks appetizing.  It looks like something I want to eat.  It doesn't look like the promo photo above, but it doesn't look like someone was flailing around and accidentally smashed up a sandwich, either. sexy Instagram caption goes here First bite: Wow.  I mean, "WOW."  Holy h*ck this is good.  The turkey has a really bold, meaty flavor.  It tastes a lot like turkey sliced fresh from your

Get Go Sandwich Standoff: "The General" vs "The Rogie Hoagie"

Get Go has been KILLING it lately with crazy sandwiches that are great for advertising on the radio but I've been wondering if they're actually great for eating. The new one I've been hearing about is "The General" which is like Chinese take-out on a sesame sub roll.  I hear ads for it every morning on my commute, and I see a giant billboard for it too.  It's basically chicken tenders with General Tso's sauce and egg rolls on a sesame bun.  I'm guessing they were inspired by Primanti's and decided to try to apply it to a different cuisine (I'm looking forward to The Russian Borscht sub which I'm sure is planned for later this summer). I ventured out to my local GetGo to try one of these out, only to be greeted by "The Rogie Hoagie" on the screen in addition to "The General."  What a great surprise (and additional gastronomic challenge)!  I decided to try them both and report back.  "The General" only comes