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.
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.
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.
If you feel this is too subjective opinion, share it over comments – I’d like to learn and grow further as an interviewer myself.
I work as Software Engineer for Microsoft Azure Production & Infrastructure Engineering team. My day to day work revolve much around distributed systems and machine learning. I am excited to explore areas like Natural Language Processing and Knowledge Bases and see if they can help solve bunch of problems yet to be commercially solved.