Interviewing for developer position has a few different stages a candidate has to go through. Some companies (especially the big ones) ask candidates to go through the algorithmic interview. This can definitely be quite frustrating as developers are put in a situation where they have to start coding while 1 or more other interviewers are observing them.
This can be REALLY stressful and it gives the feeling that if at that moment our brain freezes, that’s it, we failed… I have gone through that process a few times and I would like to share some tips that will help more developers go through that stage without losing their hair.
First of all let me talk about the following misconception I had the first time I went through that stage. The part to focus on IS NOT ONLY TO SOLVE THE ALGORITHM!!!! Focus as much as possible on TALKING ABOUT OUR APPROACH!!
Yes exactly! Understanding the problem, asking questions, say what our plan of action is, even try things that may change later on are the points to focus on! This conversation that is happening inside our head, needs to come out of our mouth.
I cannot explain how much easier it is going to be to find the right path on solving the problem. Even better, interviewers are very likely to even give us some hints as we are making this interview more interactive (and less boring for them).
In most cases, coding interviews are designed in order to see what our approach in problem solving is and how it matches the one of our potential new colleagues (the interviewers). We should think of it more of a pair programming session that we are leading.
You are asked to write a function which takes 2 strings as an input and detects if one of them is an anagram of the other. For example
abba is an anagram of
true if they are, otherwise return
console.log(areAnagrams("abba", "baba")) // true
It is common to feel like we don’t want to waste any time and instantly jump into the code. However having a small conversation around the problem and ask questions until it is fully understood is crucial for not going to the wrong direction.