During interviews, except the most frequent asked question "What does your company do", the second most asked question is "Why this interview cares about algorithm?". Today let's talk about why most companies prefer to ask algorithm during interview.
TL;DR
- During the hiring process, companies do not really worried about missing a proper candidate, what they think about the most is the Hiring Efficiency, so the decision made related to hire process is highly related to hiring efficiency.
- Algorithm is a simple and effective way to exam candidate's problem solving ability and coding ability, this is the most effective way to filter out the proper candidates
Questions from interviews
From last year, our tech team has been expanding. I've interviewed a lot of frontend, backend and fullstack engineers. Since our phone interview or onsite interview both asked algorithm questions, some candidates asked me:
"Does algorithm really helps in the daily work?"
This question was usually raised by someone that does not give a right answer to the algorithm coding problem. However I believe that many developers might wondered about this. My answer is quite simple, algorithm helps nothing in the daily work. During daily work, we usually write code to implement business logic, which is not too complicate. Then the candidates will come up with another question:
"Why this interview cares about algorithm?"
We can see, the reason that the first question was asked is the second question. 😂
My interview experience
In my all interview experience, the most impressive interview was the one in Google. After I stepped into the interview room, the first word from interviewer was "Here is the problem". Directly to the algorithm coding problem, Google was the only one company that does not even asked about anything on my resume, even no self introduction.
And the other two interviews that I've been experienced was Expedia and Amazon, no surprise, both interviews were started with algorithm.
But to be honest, I didn't event think about why these companies like to do algorithm during the interview until I've started working in a startup company. What I did was following the information I got from the internet, prepare the algorithm. After I get back to China, I found all the leading internet companies are also doing the same thing, so why?
Why developer interview cares about algorithm?
I started to think about this question seriously after I joined the startup company. When the role changed, I am not an interviewee anymore, so I started to think about this question in a different perspective.
The cost of the company during hiring
From company perspective, it would be great to hire the most proper talent with lowest cost. So what is the cost for company in hiring process?
- Hiring human resource cost: include HR department and the time cost for tech department
- Candidate trial and error cost: when the company hired someone not qualified, this staff has to be fired and restart the hiring process, this case will cost a lot of time, thus a really high cost for the company
The difficulty of the cost problem
To optimize the cost described above, the hiring process has to be carefully designed:
- To save hiring human resource cost, it would be better to have a shorter interview time, so the time of tech department could be saved
- To save the cost of trial and error, the interview should be able to get enough information from the candidate to make sure the candidate is qualified for the position. But for sufficient information, a longer interview time is required.
Efficiency first hiring strategy
To cover both points listed above, the only way to save hiring cost is to improve hiring efficiency, to find some way that able to gather the most information from the candidate.
If we can understand the the strategy above, it would be easy to understand why some "bias" exists. For example, some companies have a hard requirement for their candidate: education background, only candidates from public university would be interviewed. This does not mean everyone from community college is not as good as the public university. But from company's perspective, candidates with public university education background are more likely to be qualified than candidates from community college. For a higher efficiency, candidates from community college are rejected.
Algorithm, an effective option
Understanding the efficiency driven hiring strategy, it would be easy to understand why so many companies like to use algorithm to exam their candidates. First of all, algorithm questions is able to verify two abilities from candidate:
- Problem solving ability: break down a specific problem into a programming problem, come up with a detailed algorithm to solve it
- Coding ability: implement a given algorithm with code, make a logic to a program
People might think the most important ability for a developer is to "write" code, but actually, the most important ability for a developer is "design" code. During daily work, the time took for "design" code are usually reaches 70% to even 80%, the left part are the time to "write" code.
The two abilities above are the ones that required in developer's daily work. Although the algorithm coding problem only asks for an implementation of a given algorithm, and this algorithm might not be used in daily work, but the two abilities are necessary. So with an algorithm coding problem to exam the two abilities is the main purpose of the interview.
I think I am qualified, why reject me only because my algorithm is not good enough?
There might be someone think that, I think I am qualified for the position, I have some advantages other than algorithm, why ignore all those factors, only cares about my algorithm? This reminds me a big news before: Max Howell, the author of Homebrew, was rejected by Google.
In this case, Max Howell had significant achievement, but even this case, Google still rejected him. That is to say, candidates with strong background or big achievement failed on algorithm is not a specific case, but a common thing.
To answer this question, we need to get back to the hiring efficiency strategy. Checking all aspects of a candidate requires a lot of time, and there is still a chance that the candidate is not qualified after all checks. So for a higher efficiency, company would rather missed this candidate than spending more unpredictable time. Someone might think this is unfair, but from company perspective, this is the best choice for company interests after carefully comparing advantages and disadvantages.
Maybe it is not that bad to prepare some algorithm
Simply talk about algorithm from interview perspective, developers have to prepare it, and this process is boring and suffer. I was also tormented by KMP algorithm for several day and nights. But algorithm is not only about interviews, it will bring some real improvements to you. I will talk about this in another blog post (still working in progress, will link it after I finished).
At the end, sincerely recommend every developer do some algorithm during spare time.