What to Learn Before your Junior Software Engineer Coding Interview
29 Jan 2021
29 January 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.
Basic data structures
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:
- Create an empty one,
- Add items,
- Remove items,
- Check if an item is contained,
- Loop through the structure.
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 and space complexity
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): print("hello world")
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: print(number)
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:
class Person: def __init__(self, name): self.name = name def shout_name(self): print(self.name.upper()) me = Person(name='Adam') me.shout_name()
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!
Adam DangoorSee other articles by Adam