Preparing for a Software Engineering – interview (new grads/early-mid stage Engineers)

So you are graduating soon with a shiny new degree or maybe you are looking to make your first career jump and you have lined up a few interviews in your pipeline, but you aren’t too sure of what to expect and how to prepare for the journey ahead? Well this article aims to help guide you!

NOTE : that article covers a-lot of topics, so take your time to understand each section. I’d personally say spend a week or two (or 3) to cover the whole thing. Rushing through these topics is NOT going to help you. Learn-revise, progress-revise.

In this article, I cover the following:

  • Algorithms + White-boarding (Technical phone screen)
  • Software Design
  • Nugget #1
  • Nugget #2
  • Preparing for Soft-Skill based questions

Algorithms + White-boarding (Technical phone screen)

When it comes to interviews, from my personal experience, covering and understanding these topics is what will help you in the long run (and even after you get the job) :

1. Asymptotic Complexity:

Also known as Space and Time complexity. Knowing how much time an algorithm takes to execute and the space required for the execution of the algorithm is very important. Many people overlook this topic underestimating it.

Take this example, you are white-boarding a problem and you have reached a road block with regards to storage of the data in the problem. The interviewer wants to help you, without giving you the name of the data structure so he/she hints the following:

Can you think of a data structure to hold ordered data, such that when you add new a element in, the insertion happens in O(log(n)) time ?

Now if you would have chosen to ignore the simple Asymptotic Complexity of a Max/Min heap, there is no way you would be able to understand what the interviewer is asking you to use, at-least in the 30 min time frame that you have.

I can not stress how important this simple thing is. In one of my previous companies I have seen candidates who had a working solution, get rejected, because their solution’s asymptotic complexity was not better than nor equal to the requested one.

So from now on, what ever Data-structure you learn/pickup remember to take mental notes of the complexity.

2. Recursion

Yet another overlooked topic. Many people think that recursion is something that can be overlooked because it doesn’t have the best Asymptotic Complexity, but certain interview questions can only be solved using these.

Recursion problems are generally problems in which a function will end up calling it self (or a helper function) multiple times until a base case is encountered. A Good example is finding the nth digit in the Fibonacci Sequence.

When dealing with a recursion problem remember there are only 2 approaches in terms of traversal. That is, it is either a Top-down or Bottom-up approach.

  • Top-down approach: in this the algorithm will start with target case and goes all the way down to the smallest case, after reaching which it builds it’s way back up. For example:
def fibo(n):
if n < 2:
return n
return fibbo(n-1) + fibbo(n-2)
  • Bottom-up approach: in this the algorithm will start with the smallest case and will ultimately build up to the target case. For Example:
def fibbo(n):
result = [0,1]
if n > 2:
return result[n]
    def helper(i):
if i > n :
returresult.append(result[i-1]+result[i-2])
helper(i+1)

helper(2)
return result[n]

There are 3 types of recursion, Simple Recursion, Recursion with Side effects and Pure Recursion. I am not going to go into depth about the difference amongst the three as one can easily look them up with a google search.

3. LinkedLists

This might be the most re-visited data structure ever and yet sometimes, some of us might get stuck on this. This video covers everything you need to know about linked lists.

Here are a few important notes:

  • Traversal, Insertion, Deletion through a uni-direction linked list are all linear operations, O(n)
  • The different kind’s of linked lists are, single linked-list, double linked-list, circular linked lists, etc.
  • Linked lists are a sub-class of graph data structures

Try solving the below question :

Given a Linked List, in which integers will be added in ascending order. Write a method to the Linked List class that will return the median.
Note : 
- data will be streaming
- LinkedList class will should have a method to add new elements
- LinkedList class will should have a method to return median
Example:
ll = LinkedList()
ll.add_element(1)
ll.median() # outputs 1
ll.add_element(2)
ll.add_element(3)
ll.median() # outputs 2
ll.add_element(3)
ll.add_element(3)
ll.add_element(4)
ll.add_element(5)
ll.median() # outputs 3

4. Stacks and Queues

Most modern languages, such as Python, Ruby and JavaScript implement this using dynamic arrays/lists but understanding how these work under the hood is important as well. Here’s a video that covers the basics:

5. Trees:

Tree is a simple entity, that can get quite scary if you mess up the basics. Fear not if you already have messed up, this section will set things straight my friend.

What is a Tree? A Tree is a Data Structure consisting of nodes. Some important themes of thoughts to brush up are :

  • Each Node can have children but not every node can have a parent, namely the root node.
  • Nodes that have no children are know as leaves.
  • Trees that have 2 children at max are called binary trees.
  • Trees that have a relationship that all children and parent must follow are know as Heaps

I am sure that majority of the readers already knew what the above is, but what is it that I was referring to when I said “mess up the basics” ? Quiet simply put it’s the traversals. The insight/ability to know, when to use what type (BFS v/s DFS) of traversal is important and this can only be achieved by practicing Tree based questions, getting them wrong and then understanding the correct solution. (Leetcode is a great resource for practicing interview questions)

Here are some video to get you up-to speed on Trees :

NOTE : this video does NOT cover BFS.

Watch this video for BFS

Try solving the below question:

Given the root node of a Tree, print out each level of the tree, in an alternate fashion.
Example :
         5
/ \
2 8
/ \ \
1 4 6
/ \
3 7

print out the below:
[5]
[8,2]
[1,4,6]
[7,3]

Heaps, are a subset of trees and here is a short video that covers everything you need to know. Don’t worry too much about implementing a heap as most interviewers will be ok with you using python’s heapq module to solve problems that require heaps.

Here is a problem that you should be able to solve using two heaps.

Given a Linked List, in which integers will be added in random order. Write a method to the Linked List class that will return the median.
Note : 
- data will be streaming, and will follow no order.
- LinkedList class will should have a method to add new elements
- LinkedList class will should have a method to return median
Example:
ll = LinkedList()
ll.add_element(1)
ll.median() # outputs 1
ll.add_element(5)
ll.add_element(-5)
ll.median() # outputs 5
ll.add_element(3)
ll.add_element(2)
ll.add_element(6)
ll.median() # outputs -1, because (-5+3)/2 = -1
ll.add_element(0)
ll.median() # outputs 3

It looks very similar to the coding challenge under LinkedLists but the devil is in the details, the data is NOT ordered.

Do not worry if you do not get it right in the first go, it is a super hard problem. Here is the solution (please view it only after you attempt to solve it on your own)

6. Graphs:

Graphs are data structures that consists of nodes and a list of it’s connected nodes. The connection can be either uni-directional or bi-directional and can have weights associated to them.

Important terms when dealing with the graph are as follows:

  • Vertex : A node in the graph is know as a vertex
  • Edge : A connection/relationship between two Vertices is know as an Edge. This can be weighted or un weighted and can also be directional (ex: Instagram, Twitter) or bi directional (Facebook, Linkedin)
  • Size : The total number of Edges in the graph
  • Order : The total number of Vertices in the graph
  • Degree : The number of Edges a Vertex has

There are multiple ways to create a Graph Class, the below video covers the 2 most common ways.

Traversal through a graph can be easily done using a BFS approach (read the Tree section). Keep in mind to track the visited Nodes as Nodes in a Graph can have a closed path, i.e you can end up with an endless loop (think of a circular linked list).

7. Dynamic Programming

This is an advanced topic and can be hard to follow in the start, but when you get a hang of it get’s easier.

Fibonacci using Memoization

The below question is an ideal candidate for dynamic programming. Give it a go and leave a comment stating your time complexity for the lookup (not the storage).

Given an integer array nums, find the sum of the elements between indices i and j (ij), inclusive.
Example:
Given nums = [-2, 0, 3, -5, 2, -1]

sumRange(0, 2) -> 1
sumRange(2, 5) -> -1
sumRange(0, 5) -> -3
Note:
You may assume that the array does not change.
There are many calls to sumRange function.

8. Coding Challenges / White boarding

Practice as many coding challenges as you can before the real interview. This helps you get familiar with what to expect and the standard of questions asked. I personally have used many online tools practice coding challenges and found that leetcode and geeksforgeeks question banks are the best to practice from. They have a standard of questions that you can expect in a real interview and leetcode provides a timed mock interview (mostly on the harder side, don’t worry about your first 30–100 questions, you’ll most likely get them all wrong, rather learn from your mistakes and see how others have implemented them in the discussion section of the question). Leetcode also has paid question bank, that I recommend using, the ROI is phenomenal (if you practice consistently).

Another thing I would like to point out, having used tools like hackerrank, codefights etc and would like to point out these are tools that many companies use to interview candidates but their question banks have a pretty sub-par level of question and practicing these is most likely a waste of your time.

https://www.pexels.com/

Buy a Whiteboard, if you already have not! This is probably one of the most important tools you need! Also get multi-color white board markers as this will make your white-boarding experience a-lot more detailed. (YES, this works!)

Any problem you solve, must be whiteboard-ed first (or pseudo white boarded using comments during a screen share interview). A staggering amount of people dive head first into code when solving coding challenge. DON’T be one of them. Doing this might sometimes get you to the correct solution but most of the time it will be like juggling multiple different tasks at once and it will make you look like this :

So how do you go about solving problems? Simple! I have been using this structure in both interviewing and work environments and it always works.

Here’s the approach that I recommend. Write down the titles in bold on the whiteboard/comment space:

  • Goal : Find out what is the goal of the problem. What are you trying to solve for?
  • Input : What are the inputs that will be given to the function/endpoint?
  • Output : What is the expected output of your function/endpoint? Keep in mind there can/will be multiple outputs so make a note of them here.
  • Constraints : Are there any constraints that you need to be aware of? Space and Time Complexity? Certain rules applicable to the problem?
  • Example : Either come up with an example or ask the interviewer for one. Make sure to have example cases that are very random in structure, i.e are not too unique to one sub-set.
  • Diagram : Diagram out your approach, how will you solve this problem, using diagrams and NOT code
  • Algorithm (optional) : Once you have explained the working of your solution to the interviewer/team-mate write down your approach as algorithm using words and NOT code. Pseudo-code is allowed, but avoid it if you can. Make sure your algorithm catches edge cases!
  • Code : Now that you have an algorithm, only now start writing code to implement it. (this should be super quick because you have already done the bulk of the work in the above steps)

Here are 2 example approaches when dealing with screen-sharing

example 1: Find the century

""" 
Question : Given a year, return the century it is in. The first century spans from the year 1 up to and including the year 100, the second - from the year 101 up to and including the year 200, etc.
"""
"""
GOAL : Given an year find it's century.
- 0 (100,200,300) years are part of previous century.
INPUT : int
OUTPUT : int
EXAMPLE : 101,0,100,299
DIAGRAM/ALGO:
1) 101
101/100 = 1 => so century =  add 1 to result => century = 2
2) 0/100 = 0 => so century = add 1 to result => century = 1
3) 100/100 = 1 => so century = 2, like test-case 2?
NO, 100 is part of 1st century. So we should do a remainder check as well.
i.e 100%100 = 0,
so century = 100/100 and not 100/100 + 1
4) 299/100 = 2 && 299%100 = 99 so century = 2 + 1 = 3
5) 300/100 = 3 && 300%100 = 0 so century = 2 
"""

def centuryFromYear(year):
d = year / 100
return d + 1 if year % 100 else d

def tests():
test_cases = [(0,1),(101,2),(100,1),(299,3),(300,3)]
op = "Running test : {} | Result : {} | Expected : {}"
for test,e_result in test_cases:
print op.format(test, centuryFromYear(test), e_result)
tests()

Example 2 : Find path to a node. (NOTE: the Tree and Node class will most likely, be already implemented for you, in such a question) :

"""
Question:
An ABC notation in a tree is defined as folllows:
1. "0" means travel left
2. "1" means travel right
3. "" means hit the root
4. "Not Found" means not present in tree
Given a BST insertion order, {5,2,8,3,6,9,1} find the ABC notation for 6, 1, 10, 2 which is "01","00","NotFound", "0"
"""
"""
Goal : Given a node value, root node find if the path to the the node from the root
- 1 represents right,
- 0 reprensts left
- Return "NotFound" if not found
- Return "" if node is root node
Input : int
Output : string
Example :
Tree
1
/ \
2 3
/ \
4 5
find node : (1),(5),(6),(3)
Diagraming:
- DFS
(1)
str = ""
1-> is_val? -> true, return str
(5)
str = ""
1-> is_val? -> false, (2),(3) to stack, str += "0","1"
2-> is_val? -> false, (4),(5) to stack, str += "0","1"
3-> is_val? -> false, Do Nothing
4-> is_val? -> false, Do Nothing
5-> is_val? -> true, return back the stack
(6)
(5)
str = ""
1-> is_val? -> false, (2),(3) to stack, str += "0","1"
2-> is_val? -> false, (4),(5) to stack, str += "0","1"
3-> is_val? -> false, Do Nothing
4-> is_val? -> false, Do Nothing
5-> is_val? -> false, Do Nothing
return "Not Found"
"""
class Node:
def __init__(self, data=0):
self.value = data
self.left = None
self.right = None
     def insert(self, data):
if not self.left:
self.left = Node(data)
return True
if not self.right:
self.right = Node(data)
return True
return False
class Trees:
def __init__(self):
self.root = None
self.size = 0
     def insert(self, data):
queue = []
if not self.root:
self.root = Node(data)
return
queue.append(self.root)
while True:
# print [x.value for x in queue]
if len(queue) == 0:
return
curr = queue[0]
if not curr.insert(data):
queue.append(curr.left)
queue.append(curr.right)
queue = queue[1:]
else:
return
     # implement this function
def path_to_node(self, value):
result = [None]
        def helper(node, string):
if node.value == value:
result[0] = string
return
if node.left:
helper(node.left, string + "0")
if node.right:
helper(node.right, string + "1")
        helper(self.root, "")
return "NotFound" if not result[0] else result[0]
tree = Trees()
def tests():
for data in range(1, 6):
tree.insert(data)
    test_data = [1, 5, 6, 3, 9]
for test in test_data:
print "running test {} | Result : {}".format(test, tree.path_to_node(test))
tests()

Software Design

When dealing with Software Design interview questions, keep in mind there can be 3 types of approaches that the interviewer might have in mind and it is always a good idea to clarify which category is the interviewer interested in, either one of them or all. They are:

  • System Design
  • Class Hierarchy
  • Method Implementation

Nugget #1 (Full-stack engineering)

This section covers topics that you must be aware of as a Full-stack/backend engineer. If this does not apply to you, you can skip this.

Distributed Systems

A topic that you must be familiar with is Distributed Systems architecture. Fear not if you are not familiar with this, here is a SHORT video to bring you up-to speed on the high-level:

And here’s a 40-some minute video that dives in deeper.

Micro-Services Architecture

What is a micro-services architecture?

Micro-services architecture is an architecture approach that providea loose coupling between collaborating processes which running independently in different environments with tight cohesion

If the above doesn’t make much sense then go through the below.

Here’s another good resource on micro-services

Docker

Docker is an amazing tool !!! In a nut shell it is this virtual environment in which you develop your code and define resources that your application uses, so that there is consistency in dev environments and production environments.

A short intro :

A deeper dive:


Nugget #2

This section covers a few topics ALL software engineer should know, so do NOT skip this one.

Development Methodology (TDD vs BDD) :

There two widely used test methodologies used in the Industry. Here are some videos that give an overview.

HTTP protocol

There is a good chance that you will have to deal with HTTP at some point in your role and hence be prepared with the basics and fundamentals of this protocol.

These three videos cover everything you need to know.

Git:

Git is a version control system that is widely used and you will be expected to know the basics on this.

Here’s a video to give you an abstract understanding of git and github.com

Here are some videos that runs through the basic git concepts (committing, branching, etc) that you should know:

Linux:

There is a really good chance that you will be deploying (or even testing) on a Linux Environment and you might get asked linux based questions. Here are 2 videos that cover it all.


Soft-Skills:

This is a section where most people fail. Four pillars that make you an awesome engineer (and a awesome person) are Empathy, Humility, Truthfulness and Confidence . Practice these in your daily life to get better at them.

https://giphy.com/gifs/school-back-guinea-tHufwMDTUi20E

Let’s start answering a few common questions that you will be asked at some point.

Tell me more about yourself?

A daunting question to many but if you apply empathy, i.e what might be the reason for someone to ask you this question and where are they coming from, makes the answer much more easier to structure. Let’s take 3 different types of people who might ask you this question: 1) The Recruiter 2) A Software Engineer 3) The Hiring manager

I . The Recruiter: When the recruiter asks you this question, he or she is trying to figure out how many skills/tools on the resume match your skill-set. All they are looking for is are you a good match for this role or not.

A good way to reply to this is as follows:

“At company ____, I was a part of a software engineering team that was responsible for building ______ platform/tool built using languages ________. The data-base involved in the project was ______ , we stored our code on _______ and deployed it on _______.”
“At school, I along with a group of ____ team-mates, I helped develop ________, built using languages _______. The data-base involved in the project was ______ , we stored our code on ______ and deployed it on _______. The result was _____.”

II. A Software Engineer: When a software engineer asks you this question, he or she is trying to figure out what sort of problems have you solved in the past and also the software stack. Keep it short and simple, you DO not want to bore someone with too much detail, it can come across super rude and it also eats into your coding/white-boarding time (I know, I have done it many times in the past.)

A good way to reply to this is as follows

“At company ____, I was a part of a software engineering team that was responsible for building ____, a platform/tool that does ________. My contributions to this platform/tool was to ______, ______ and _______.”
“At school, I along with a group of ____ team-mates, I helped develop ________, a platform/tool that does ________. My contributions to this platform/tool was to ______, ______ and _______.”

III. The Hiring manager : The Hiring Manager is the decision maker, be very very very to the point when talking to him/her but also show enthusiasm when talking about your past projects.

Answering this question when asked by a Hiring Manager is a mix of the above two. He/She is looking to see if i) you have the skill-set required, ii) what you have helped build in the past iii) culture fit iv) technical ability.

A good way to reply to this would be as follows (NOTE: only highlight project(s) relevant to the Job Description):

“At company ____, I was a part of a software engineering team that ____ engineers in it and was responsible for building ____, a platform/tool that does ________. My contributions to this platform/tool was to ______, ______ and _______. Languages involved were ________. The data-base involved in the project was ______ , we stored our code on _______ and deployed it on _______.”
“At school, I along with a group of ____ team-mates, I helped develop ________, a platform/tool that does ________.”

Where do you see yourself 5 years from now?

This video sums it up perfectly! Go through it and form your own answer.

Other questions:

There are many other questions, and most of them can be answered by using the STAR methodology ( Situation, Task, Action and Result). I’ll put in a video for your understanding of the method and also a few other questions that WILL be asked. Remember the 4 pillars (Empathy, Humility, Truthfulness and Confidence), when answering these.

  1. Tell me about a technical challenge you faced and how you solved it.
  2. Tell me about a time a project failed and what did you learn from it.
  3. What do you want in your next role?
  4. Tell me about a time you had an approach to a problem and it was overlooked, how did you respond to it?

Conclusion

I would like to end this article by saying, I know how hard and demanding the interviewing process can be. There will be rejections, there will be a lot of stress but never lose hope. Keep notes of each interview, contemplate on what went wrong and fix it, so you don’t make the same mistakes twice.

When things don’t go your way, remind yourself why did you start in the first place and get back at it. Sooner or later you WILL get that job that you want (it’s simple math) but it’s on you to be pro-active, motivated and to continuously learn from your mistakes.

Hope you land your feet in your dream job soon!

Give this a clap or two (or ten) if this brought you some value. Clapping/Liking on this platform helps with the visibility of this article. Thanks !