Best programming language for Coding Interviews

leangaurav
4 min readJan 28, 2023

Technical interviews require you to solve multiple problems using some programming language. There are multiple options and we obviously want to choose the best language. So the question is:

Is there a best programming language for Programming Interviews ?
NO

This guide is to help you pick a language that fits your purpose. I’ve listed some points I use while picking a language. I’ve also added some details and suggestions based on my background.

Pick a language that is:

Simple, Expressive and Easy to read🍰

It’s better to pick languages which are simple and expressive. Your interviewer may not be familiar with the language you are using and a simple language lets you write smaller snippets which are easy to explain.

A language that allows you to code faster 🏃🏻‍♀️

I have a good C++ background, but still I find C++ less readable and more wordy. When taking interviews, if I see someone using C++, it’s most likely for them to take more time to solve the same problem compared to someone using Python for example. This doesn’t mean it’s a poor choice. If someone is well experienced with C++, they do good, otherwise they end up spending a lot of time understanding and fixing temple errors.

Popularity⭐

Pick a more adopted language. Everyone mostly has some experience with some common languages like Python, Java, C++, Javascript. Pick one of these as your interviewer is most likely to know atleast one of them.

If you look at the most popular programming languages in the stackoverflow dev survey and leave aside non-programming languages, we get the top 6 (just to get C++ in 😜):

  1. Javascript
  2. Typescript
  3. Python
  4. JAVA
  5. C#
  6. C++

If we add some context to this survey like FE or BE developer. ML engineers etc. Obviously, order would change. But still the top few will help you figure out what to choose considering you domain.

Language that has more libraries 📚

JAVA, C++ etc. are mature languages and provide most of the data structure in-builtin. Python is a good language, but it lacks some DS like trees in the standard library. You most likely won’t be allowed to install external packages. However python has a lot of other cool stuff to make your life easy in a coding interview (Batteries included 🔋).

Use two languages and switch
A single language can not be good at everything. So, keep two languages in your arsnel 🏹.

1️⃣a scripting language like Javascript or python. Ones which don’t require you to type a complete main function to run a single line of code.

2️⃣some pure oriented language like C++ or JAVA. Even python fits here. Choose second language that does what your primary can’t.

I personally mostly code with Python and switch to C++ when required. At work I don’t code in either now (Sometimes rarely I do in python though).

However this can be a double edged sword ⚔. It’s often easy to remember one language’s syntax and trying to use 2 might leave you confused with syntax in an interview. I’ve faced this problem some times.

Pick a language based on your domain 👷🏻‍

This is one of the most important things. Obviously if you are interviewing for a Frontend role, Javascript would be the obvious choice and even you would be comfortable with it. ML engineers would prefer python. App developers would use something else.

Pick your language. You know your domain better.

Language performance and speed 🚀

Often you would solve a problem on Leetcode etc. using Python and it would give a TLE. Writing same solution in C++ or something gets accepted.

This happens mostly during online tests and in such situations, you need to definitely pick a language that works faster.

However in interviews, even if there’s a TLE, your interviewer is focused on time and space complexity. Hence it shouldn’t matter there. (Except if your interviewer is not interested in anything but the test cases passing 😥)

If you are starting fresh in your software journey, just pick any languge and get started. Beginners often find Python, Javascript interesting and easy to get started. Gradually as you navigate your way through the industry, you will end up learning multiple languages. If you already know bits of C++ and Java, go for it.

Do share if you found this useful and remember..
There’s no perfect or best programming language !!
All the best for your next machine coding interview👍🏻

--

--

leangaurav

Engineer | Trainer | writes about Practical Software Engineering | Find me on linkedin.com/in/leangaurav | Discuss anything topmate.io/leangaurav