How to choose a programming language for Coding Interviews ?
Confused between C++ and Python ?
The most straight forward answer to this question is pick whatever language you are most comfortable with. The only two exceptions to this are — it is not a language specific role, and the language you pick is quite rare/complex and there is a good chance that your interviewer may not be able to follow it.
They really don’t care
Interviewers don’t care what language you pick to solve problems. Coding interviews are mainly to test:
- Problem solving/logical thinking skills
- Computer science fundamentals — Data Structures and Algorithms, and other concepts/patterns.
- How quickly you are able to implement the solutions you come up with.
- Communication skills — the ability to articulate your thoughts and explain the solution easily.
So pick a language that you are most comfortable with. The most important thing is that the language should not become a barrier while coding. You ideally should be focusing 100% on the problem and not be thinking about the syntax while coding.
Now if you are interviewing for a language specific role, then I think it is common sense that your interviewer would be expecting you to code in that language. They may even ask you some language specific concepts.
C++ or Python ?
I think these two are the most common languages that people have a hard time choosing between. Maybe Java too.
If you are comfortable with one much more than the other, just pick it.
If you are confused, then my answer is simple — if your goal is to only pass coding interviews go with Python. If you are also interested in competitive programming, then choose C++.
Python is simple. Easy to read. Almost everyone can follow Python, even if they have not seen it before. It looks like pseudo code. Also, it has some useful inbuilt functions, easier to work with numbers and just overall takes less brain power to code in Python, when compared to something like C++. Which simply means you can use 100% of your brain to solve the problem at hand.
Now you should go with C++ if you are interested in competitive coding. You can do competitive coding with Python too. But if you want to get on the leader board of some coding contest, then C++ would be a better choice, simply because it is fast. You can use the same to interview.
Pick one and just go with it
Like I had mentioned in the beginning — companies don’t care what language you pick.
So just pick one and go with it. Never think about this decision again. Do not let others change your mind.
The worst that could happen is that, your interviewer does not know the language you chose. In this case solve the problem and write pseudo code. Look at the pseudo code and translate it into a language if necessary. Most interviewers would understand.
Hopefully you have a decision now. Next step is to take action — practice. Picking a language is just the first step, and this wont have a huge long term impact. Good luck !