Better technical interviews — don’t ask your candidates to implement BFS

Interviewing is hard, it’s a hard and stressful moment for the candidate. But it’s also a very exhausting moment for the interviewer.

Essentially you have 90 minutes to decide if candidate is competent, matches the company culture, and great person to work with.

In the following posts I’m going to share some of the experience I’ve gathered from interviewing couple of hundreds of people for various technical positions.

This time I would like to tackle one of the most controversial interview methods there are. Also known as the — “can you please solve BFS* of the board”

*you may replace BFS with any non-trivial algorithm of your choosing. Sort, binary-trees, and everything with strings included.

Don’t ask them to implement BFS

The reason I’m not a fan of “can you please implement BFS on the board” is not because I think it’s not a relevant knowledge. I actually believe that every half competent candidate should be able to figure out how to implement BFS quite easily.

Most of the grief candidates have with such line of questions is that they feel this question are artificial and have little to no relation to their experience and day to day work. And if they’ve just studied a little bit more, or read the right book just before the interview they would have answered it quickly and easily.

The reason it happens is not because our candidates are lazy or stupid, it happens because when asked a question in such form, our brain turns from a problem solving machine, to a solution seeking machine. And instead of thinking on how to solve the problem we are franticly searching in our memory for the ‘by the book’ solution.

So essentially the candidate mind goes DFS while looking for the solution. (Yes… I know… a really bad pun), and the last thing you want from a candidate is to go DFS.

Another problem with this line of questions is that it represents only a partial set of the skills an engineer must have.

Think about it. When lately you’ve been asked to solve a problem using a predefined algorithm? Solving a real-life problem is usually more than just implementing a certain algorithm. It’s about formalizing the problem, finding MVP, properly modeling the data, matching the correct tool to the problem, testing, optimizing and so forth.

Asking a candidate to solve some isolated algorithm without any context, prevent you from learning these really important details about the person you are interviewing.

Instead, ask them to implement something that requires BFS

So how do you ask about BFS, without asking about BFS? You ask them a real world question, which is related to your domain, and requires them to use all of their knowledge including, but not limited to, graph traversal.

For example, if you work on social network, you may ask a simple question about finding the closest friend who knows Kim Kardashian personally. (It’s going to be a killer app!)

While most of you might say “oh, it’s just a BFS it disguise!”, but I believe it’s a little more than that. The neat things about phrasing your question like this is that you finally can watch how a candidate might handle a problem he might encounter on his first week.

You know these types of problems — a problem where the solution is not very clear, and sometimes not even the requirements. But the spirit of the problem, and its importance to the business are crystal clear.

And as a side effect, suddenly traversing on graph doesn’t seems like a very hard problem for a good engineer. And as a nice bonus, if a candidate can name the way he solved the problem as BFS, then you know you have found someone who can actually name the tools in his toolbox (not a minor achievement), Or at least had the luck of reading the right text book just before the interview.

Don’t miss the opportunity of asking real world questions

A technical interview could be a great way to explain to the candidate the real world problems you are facing on a day to day basis. Don’t miss the opportunity to share how awesome is what you do, just by asking the right question.

I for example, love to ask candidates to implement AB Testing infrastructure. The reasons I love this question so much is because -

  • It’s an actual problem that we solved for our website. And I could explain pretty easily why it’s an important problem to solve.
  • It raises really good business discussion on top of the technical discussion.
  • It’s a complete and isolatable problem, it can be solved to some extend in less than an hour.
  • It’s a fractal question, I can go infinitesimally deep with the complexity I can add to the problem, to test different aspects of the candidate.
  • I actually have a real world experience in solving it, so I can bounce ideas with the candidate, lead him to the right places. And create a great discussion about it.
  • I can share constraints that don’t feel forced.
  • It allows me to explain what “data driven” culture is, and why it’s personally important for us as a company.
  • I can actually show how it works in our product (which is a really neat experience)

It’s important to note I take special care to explain how this problem is an actual problem we solved, and explaining its importance to the business. And almost every time I get feedback from candidates how much they loved this question, just because the problem felt authentic, and made them better see what we are doing, what we are proud of, and what we hold dear as part of our culture.

So in a strange and magical way, a well told question can actually create more clarity and understanding. and allows us, while learning about the candidate, to tell our story a little bit better.

So… what is the interview question that tells your company’s story