Best Data Science Interview Questions
In my most recent interview cycles in pursuit of my next dream job, I encountered a lot of really interesting companies in the Boston area: technology firms, pharmaceuticals, biosciences, bigData, gaming, lead-generation (spammers!), financial news services, travel curation, tour operators, retail, the list goes on. In the process, I fielded literally hundreds of questions around data science and analytics. Having been on the hiring manager's side of the table for so many uninterrupted years at this point, it has been a really interesting experience to see how others handle this process. And while the evolving art of data science is interpreted differently by all, the fundamentals are pretty consistent as evidenced by the kinds of questions that people use to classify the candidate pool.
Here are a sampling of some of the most interesting questions that I encountered along the way. There are no boilerplate questions here because, well, they don't meet the interesting criteria.
You have access to the linkedIn data set. What is the best company to work for in the United States?
No lies, this question is awesome for so many reasons. Budgeting 1 hour for this question, the candidate will have to wrestle with their own notion of "best" and build a data model that supports it. But the primary reason is that it evens the playing field (unless the candidate is a linkedIn data team alum) by presenting a familiar problem to everyone in the applicant pool.
The second virtue of this question is that it elicits the candidate's base preferences for a work environment. Does the candidate want everyone to have advanced degrees? Is this candidate inspired by places that tend to keep employees for extended periods of time? Is there a set of skills that the candidate wants to be developing? What is the ideal breakdown of sales to engineering? So there are cultural fit issues being addressed out loud.
This question also forces the candidate to think creatively about metrics creation, extracting quantitative values from things like job titles, companies, locations, recommendations, skills, etc.
Write an algorithm to determine if two strings are anagrams of each other. Ok, great. Now come up with another one. Which one performs better?
This is one that I've used personally and incidentally, it is one that I encountered in the last 6 months of interviewing. Many many solutions. This could also be used as a preliminary pseudo-coding/whiteboard exercise question. To come up with one solution requires the user to think in code; to come up with a second solution requires the user to be creative. Often the interviewee will come up with several solutions when formulating their first.
A man is described as 'nice', 'quiet' and 'orderly' by 3 associates. Build a classification system that will determine if this person is more likely to be a farmer or a librarian. Assume you have access to all data on the internet.
I know. It's ridiculous. Why would we ever want to do this? And that is precisely the point. You may end up working at a software company, but as a data scientist, you will find yourself trying to determine if 2T diapers should be classified as "Baby" or "Toddler". It's the same!
I took the bait and marched down a very complicated path of trying to explain the fundamentals of a Naive Bayes/Tf-IDf solution using the supplied tokens and evaluating against a corpus of professional network data with labels. Without even paying attention to the dearth of meaning in the descriptors, it didn't immediately occur to me that one can simply ignore the descriptors and focus on the second feature: the person's gender. This is where the question becomes a bit of a consulting interview, but with more data. It tests your estimation skills as you try to generate prior likelihoods of being a farmer or librarian, which can only be done if you are able to make a guess as to how many farmers there are in the US. Likewise for librarians. And then generating the conditional probabilities of having that gender given that someone is a farmer/librarian. The insight that the interviewer was going for in this case was that the male farmers significantly outweigh females and that the female librarians significantly outweigh the males.
You have two eggs and a 100-story building. Design an algorithm that will most efficiently determine the highest floor from which you can drop an egg without it breaking. Assume the eggs are completely identical in all properties.
This question is just one of those really fun, mathy problems that you don't get to think about every day, certainly not in most professional environments.
To get you started on this one, simplify. What if I had only 1 egg? what would I do? I would start at the first floor, drop it off, and if it didn't break, I would go to the next floor, and repeat until the egg broke at floor n, leaving n-1 as the highest floor.
Next phase is to assume you have 100 eggs. Your first move is to drop from 50. If it breaks, then you split the difference: 25; else you advance up to 75. And keep doing the same until there is convergence. This will take in a worst case scenario log2(100), or ~ 6.645 drops.
Now getting back to the original question, you can be pretty sure that the optimal solution has a first move that is somewhere between 1 and 50. So probably the easiest way to start is with a random number on that interval: say, 10. We drop off at the 10th floor, and it doesn't break; now where? let's keep it simple and advance by the same amount: 10. We drop off at the 20th floor and still no breakage. Now where? 30. Worst case with this C=10 strategy, the egg breaks on the 100th floor (10th toss), then we go down to 91 and iterate through until a our second break on floor 99, for a total of 19 tosses.
Can we do better?
For full details, see this post with the fully generalized solution: http://datagenetics.com/blog/july22012/index.html
How many people must there be in a room to have a > 50% probability that at least 2 people share a birthday?
I love probability "games" like this. And many applicants will know the answer because they are good at remembering numbers. I've had a few people respond "23" without thinking about it, which is the right answer. But they have to dig deeper than that to pass the test.
Starting simple and assuming no leap-year babies, the room has 1 person. The probability that a second person enters the room with the same birthday is 1/365; conversely, the probability that they do not share the same birthday is 364/365. Thinking about it this way is really the key. A third person enters the room, so they have a 363/365 chance of not sharing the same birthday. And so on.
Generalizing, you can formulate the following equality:
p(n-people not sharing at least 1 birthday) = 365!/((365-n)! * 365^n)















