Picking a Language
In the coding interviews, you are expected to code a working solution in a programming language of your choice in 45 to 60 minutes. To be able to do this, you need to practice, but first, you will need to choose which programming language you will be using.
Pick one programming language, and stick to it. In most companies, you can use any language for the interviews, as long as it's not very esoteric and rare.
The best choices for interviews are probably Java, C++, and Python. You can use them for interviews in almost all companies (as long as the position is not language-specific), and they are well suited for the interviews. Also, there are a lot of good resources and interview problem solutions in these languages, which will be helpful in the preparation.
Some other languages you may consider using if you are comfortable with them are Swift, Kotlin, Go, and JavaScript. But I would recommend using them only if you have a lot of prior experience with them.
Style guide
Once you pick your language, I would suggest reading some style guide for that language and then following it. This way you will learn some well-established practices, and won't debate choices about how to best write something.
Google has good style guides for Java, C++, Python, and some other languages, that you can follow:
Getting good at the language
Whatever language you pick, I recommend you learn it well and become pretty good at it. In fact, your coding interview may have some language-specific questions testing how well you know your language.
Learning the details of the language will also definitely make you a better software engineer, and prepare you for the interviews.
One of the best ways to learn the language well is to read a great book on it. Here are some books I recommend:
- Effective Java – the best book on Java, and I would recommend reading it even if you mostly use some other language.
- Effective C++ – a classic book on C++.
- Learning Python: Powerful Object-Oriented Programming – one of the most recommended books on Python, but I have never actually read it.
Learn your libraries
Modern programming languages have a lot of built-in libraries for common algorithms, data structures, and other tasks. It's a good idea to use them whenever possible, rather than reinvent the wheel: this will save you time, and built-in libraries are usually very well-tested, so this can save you a lot of bugs as well.
Learn libraries in the language of your choice, and try to use them when solving the interview questions.
Learn from others
Even if you have solved the problem yourself, it is a good idea to see how others coded it in your language. This way you can learn a lot of small techniques and patterns that you may have missed, and get better at your language.
Sometimes it is fine to try using one language – say for a week – and then to switch to another one. But it is a good idea to eventually pick one after a week or two, and stick to it.
- What is the naming convention? How to name variables, functions, and classes?
- What is the convention with comments, braces/parentheses, exceptions?