While I was working with Microsoft, I had opportunity to take around 10 – 20 coding or design interviews (candidates with 1 – 12 years of experience). There was this one thing that I felt was too common, which would lead to bad impression and potential rejection – it’s that the candidate attempts to solve every part of the question rather than focusing on what is important. This is particularly prevalent amongst candidates who chose C / C++ as programming language of choice. And, this was common irrespective of years of experience.
Here’s an example – 165 – Compare version numbers
Given two version numbers for example “1.4.5” and “1.3.6” return the greater one
Now, this is a fairly simple question when first looked at – however, it has some ambiguity that you need to resolve. But yes that’s not the focus of this post. When I present this question, before the candidate is about to start coding – I explicitly mention:
Please feel free to use as much abstraction as needed, if there is something particular I am interested in I’ll dig into it.
Of course with this sober simple face.
Now, amongst other possible approach the one that is most general is to split the string on “.” as a delimiter and convert the values to integer and then compare left to right, assuming the given value is a valid version number. I have seen many spend time on the first sub problem
splitting and converting to integer.
In my experience I have seen folks attempt it as follows:
Now as an Interviewer - This gives me a very bad first impression. When I give a question to a candidate, amongst other things I am judging how it’d be like to have:
- The candidate in my team working on a project along with me.
- Doing my code reviews
- Pushing code to production which we maintain.
- Have high level discussions with this person
I’d want the other person to talk important things and dig as needed – more like use as much abstraction as needed. This may be subjective, but this is how I may answer things and would expect similar approach from an experienced candidate.
The major idea I wish to share here is for candidates to focus on problem at hand and not try to solve all the sub problems unless explicitly asked. There is a limited time at hand to show your best.
If you feel this is too subjective opinion, share it over comments – I’d like to learn and grow further as an interviewer myself.
Want to read more such similar contents?
I like to write articles on topic less covered on internet. They revolve around writing fast algorithms, image processing as well as general software engineering.
I publish many of them on Medium.
If you are already on medium - Please join 4200+ other members and Subscribe to my articles to get updates as I publish.
If you are not on Medium - Medium has millions of amazing articles from 100K+ authors. To get access to those, please join using my referral link. This will give you access to all the benefits of Medium and Medium shall pay me a piece to support my writing!