29 Jan 2021
3 min read
I'm Adam, an experienced software engineer and a professional interviewer. For over two years, I have been working with candidates in the software industry and other industries to improve their chances of landing a great offer. This article provides a few tips and tricks which I have used with candidates to help them to ace the interviews focused on live coding.
Interview content can vary greatly but my experience has shown me that having a good grip of the following concepts can be a big boost.
An interviewer will not expect you to know every data structure, but if you know a few then you have the tools to solve most problems given to junior software engineers.
Those are: Strings, Arrays (also known as "Lists"), Hashmaps (also known as "Dictionaries"), and Sets.
Try to get to the point where you can create and interact with these data structures in your language of choice with ease.
For each of strings, arrays hashmaps and sets, you should be able to:
For strings, you should know how to split a string and how to add two strings together (also known as concatenation).
Know the difference between a set and a list. In particular, a list has duplicates and order, but a set does not. This allows some set operations to have better time and space complexities (which is up next!).
Time complexity is a way of describing the performance of an algorithm with relation to the size of its input(s). It allows you to say "The time taken to run this algorithm will roughly double in the worst case if the length of the input doubles" in a clear notation.
Some of the key time complexities include:
O(1), aka "constant": The time it takes to run the algorithm is not impacted by the length of the input.
def print_hello_world(my_ignored_input: str):
is a good example.
O(N): In the worst case, the time it takes to run the algorithm will grow proportionally with the size of the input.
def print_even_numbers_in_list(my_list: List[int]):
for number in my_list:
if number % 2 == 0:
Space complexity (sometimes known as "memory complexity") is a very similar concept. Instead of describing the performance in terms of computer operations needed, space complexity refers to the size your variables take in memory.
There are many great resources on time and space complexity. I recommend searching on Google or YouTube and finding one which explains it in a way which works for you.
In an interview, this typically comes up when an interviewer asks for you to describe the time and space complexities of a solution you have come up with. To do this you often need to know the time and space complexities of the operations I mentioned in "Basic data structures", so learn those too, as well as the concepts.
I recommend writing some code for the following algorithms as they often come up in interviews:
Depth First Search
See this guide for a great explanation and example code. This involves recursion, and it is important to understand recursion before an interview, so this is a 2-for-1!
Choose any sorting algorithm and understand it.
There are so many algorithms which may come up, but knowing those two can go a long way.
Know how to create a class and an object from that class. Know how to run a method with a parameter which accesses an instance variable. That may sound complex but it can be as simple as:
def __init__(self, name):
self.name = name
me = Person(name='Adam')
Keep practising! This can be on Leetcode, HackerRank, or using Pramp. Get used to writing code in a web-based text editor and know your language well. If possible, I recommend knowing Python or Ruby or another very high-level language. If you only know C++ or Java, you might have trouble in timed interviews because those languages do not shine in that kind of environment.
Best of luck!
See other articles by Adam
Ground Floor, Verse Building, 18 Brunswick Place, London, N1 6DZ
108 E 16th Street, New York, NY 10003
Join over 111,000 others and get access to exclusive content, job opportunities and more!