Even if you have years of software engineering experience under your belt, the technical interview can be daunting!
For junior developers, you may be afraid that you haven't prepared enough—that you might call the wrong variable in a time crunch.
For senior software developers, the fear may be related to not being as familiar with programming language or concepts.
You've been managing teams for so long that your database skills aren't quite as sharp. Or maybe you're going out for a job that uses an object oriented language you've never used before.
You've read the books, taken courses, and still feel you may not be ready for the technical interview.
Luckily, we've put together a coding interview cheat sheet of all the major principles you can expect to see in your technical interviews.
In this guide, you will learn about:
- Linked Lists
- Hash Tables
- Graphs & Trees
- Stacks & Queues
- System Design Principles
- Load Balancers
- Time and Space Complexity
- Programming Languages to Use
- Coding Interview Dos and Don'ts
- Even More Coding Interview Practice Questions
Along with this cheat sheet, be sure to check out Exponent's Software Engineering Interview Course.
When it comes to data structures, nothing is simpler than an array. But arrays are far from insignificant!
What is an Array?
An array is an ordered list of data that is accessible with a numerical index.
In many cases, software engineers will allocate arrays upfront as a single block of memory according to the amount of elements and kinds of data that must be stored in the array.
Because of this, arrays allow engineers to read and write elements more efficiently. Arrays tell your program exactly where every element is stored within memory.
Things to Know About Arrays for a Technical Interview
Things to keep in mind for your technical interviews regarding arrays:
- Arrays are optimal for indexing but not for searching, inserting, and deleting.
- Linear arrays are the simplest types of arrays.
- Dynamic arrays are similar to one-dimensional arrays. However, they use reserved space to store extra elements.
Most Common Array Interview Questions
- Find Triplet with given sum in an array (View Answer)
- Find maximum product of two integers in an array (View Answer)
- Move all zeros present in an array to the end. (View Answer)
- Sort a binary array in linear time. (View Answer)
- Merge two sorted arrays. (View Answer)
- Given an unsorted array of integers, find a pair with the given sum in it. (View Answer)
- Partition an array into two sub-arrays with the same sum. (View Answer)
Additional Array Technical Interview Cheat Sheets
The next most fundamental data structure in software development is the linked list.
What is a Linked List?
Linked lists allow engineers to insert/remove elements from a list without the need to re-allocate or move the elements.
In doing so, linked lists can thwart what would otherwise be the worst-case performance scenario of arrays.
Linked lists are also frequently used as a building block for anoother, more complex data structure.
Linked lists operate a little differently than arrays. Rather than storing data in blocks of memory, a linked list uses nodes connected to pointers.
Things to Know About Linked Lists for Technical Interviews
During technical interviews, remember to use linked lists when you need to insert/delete items from a list.
This is especially important if the size of the list must be flexible.
Keep in mind arrays are better for indexing and hash tables are better for searching.
Most Common Linked List Interview Questions
What are Hash Tables and How Do They Work?
Hash tables are effective for searching.
Hash tables are key-value data structures that contain three parts:
- Linked lists,
- Hashing functions
The hashing function component of a hash table transforms the key. The key is a piece of data that is transformed into an array index by the hashing function.
The reason for this is the array index is used for efficient lookup.
Ultimately, this array index then becomes the hash table.
When Should You Use a Hash Table?
You should use a hash table if you need constant-time lookup, insertion, or deletion functions.
Remember that hash tables are not the best choice for storing sorted data.
- Hash tables are designed for optimized searching, insertion, and deletion.
- A hash collision refers to a hash function returning the same output for two separate inputs. This is a problem inherent in every hash.
- Hashes are critical for symbol tables and indexing databases.
How to Calculate Memory with a Hash Table
Many coding languages have things like sets, objects, and dictionaries that utilize hash tables.
Depending on the language, the memory usage of a hash table may vary wildly.
In most cases, you should use a fixed-size array when creating a hash table. You should use linked lists for storing the data.
Hash Table Operations
- Inserting key-value pairs
- Finding a key's value
- Updating a key's value
- Seeing if a key is already used
- Looping over key-value pairs
- Deleting key-value pairs
- Searching for values
Most Common Hash Table Interview Questions
Additional Hash Table Technical Interview Resources
- Learn more about hash tables from Exponent's own SWE team.
- Common hash table technical interview questions
Graphs & Trees
Another group of important data structures is graphs and trees.
What are Graphs in Programming?
A graph is a data structure composed of two elements: vertices linked together by "edges."
These edges can be directed or undirected, depending on how they are used.
There are many practical uses for graphs.
For example, in a GPS application, roads could be the edges, while intersections would be the vertices.
When it comes to technical interviews, it will usually be clear when to use graphs.
Your interviewer will likely tell you to use one outright, or the data set in question will consist of vertices and edges.
What are Trees in Programming?
Trees are a data structure similar to graphs. They are also widely used on a day-to-day basis by software engineers.
They usually appear during the technical interview in search and traversal questions.
A tree is a collection of nodes in which every node includes references to zero or more child trees.
As you can probably already tell, trees are defined recursively.
This suggests that recursive algorithms are pertinent when faced with this kind of data structure.
The nodes in a tree are comparable to the nodes of linked lists.
However, the nodes of linked lists only contain one memory pointer to another node.
The nodes in trees, though, can contain any number of memory pointers to child nodes.
As such, trees are technically a kind of graph. They are sometimes referred to as directed acyclic graphs.
This means that basic algorithms such as breadth-first search and depth-first search are used alongside graphs and trees.
Things to remember about trees during your software engineering interview:
- Leaf node: This is a node without any child nodes.
- Root node: The topmost node in a tree. This will usually be the node interviewers will give you in your coding problem.
- Height The distance between the root node and the lowest leaf node.
- Subtree: The node under the root node and all of its children.
Most Common Graphs and Trees Technical Interview Questions
- Print left view of a binary tree. (Watch Above)
- Determine if given Binary Tree is a BST or not
- Construct a Binary Tree from Ancestor Matrix
- Check if two given binary trees are identical or not
- Find Lowest Common Ancestor (LCA) of two nodes in a binary tree
Stacks & Queues
What are Stacks and Queues?
Stacks and queues are two high-level data structures used for storing a list of elements.
Queues operate along the lines of “first-in, first-out” (FIFO) behavior.
This means that elements are enqueued and dequeued in the same way they arrive, as the name suggests. The first element in is the first one out.
Stacks, on the other hand, operate oppositely. They use a “last-in, first-out” (LIFO) procedure.
This allows elements to be recovered in the reverse order they arrived.
Imagine stacks like stacks of pancakes. The top-most pancake, the first one to be retrieved, was the last to arrive.
Stacks and queues are typically executed alongside a linked list or array.
Stacks and queues are critical components of many basic algorithms in software engineering.
Stacks and Queues in Your Technical Interview?
During your interview, it's best to use a queue when your problem requires you to process items according to the order received.
Stacks are used when items need to be received in reverse order.
Stacks and queues are often used in graph search algorithms, web crawlers, and storing application history.
Common Stack and Queue Interview Questions
Your interviewer may ask you to perform these general functions in your interview. Use the language you're most comfortable with.
- Pushing items to a stack
- Popping items from a stack
- Looping over queues and stacks
- Peeking the top of a stack
- Stack reversal
- Getting a stack's size
- Getting a queue's size
Click here to learn more about Stacks & Queues from Exponent.
Sorting is an essential concept in software engineering and, by extension, engineering interviews.
There's a very good chance you will be asked a sorting question in your interview.
Sorting in a Technical Interview
- The interviewer may give you a set of data that has already been sorted. They will then ask you to sort the data more efficiently.
- The interviewer will ask you to solve a coding problem that requires sorting to solve efficiently.
- A sorting algorithm is necessary to manage a particular set of data in the coding problem.
Types of Sorting Algorithms
- Insertion sort - Best for short lists, stable, and in-place.
- Quicksort - Often fastest in practice, can be in-place but not stable.
- Mergesort - Stable but not in-place.
- Heap sort - In-place and better worst-case runtime than quicksort
System Design Technical Interview Basics
- Scalability: First and foremost, a well-designed system must be scalable. This means it can handle increased traffic while still operating with efficiency.
- Reliability: Ultimately, scalability means nothing if a system is not designed reliably. Reliability in system design means the system can continue to perform its necessary functions, even in the event of user mistakes, while also preventing unauthorized abuse or exploits.
- Availability: A well-designed system must necessarily be an available one. This means it can perform its necessary functions over time. In other words, the uptime/total time.
- Efficiency: As you can imagine, it's difficult to say a system is well-designed if it's not efficient. If your system can function quickly, then it is an efficient one.
- Maintainability: Last but not least, maintainability. A system must be maintainable: making it operate must be straightforward so that other engineers can modify and maintain it over time.
System Design Technical Interview Questions
Exponent published a full guide to the system design interview. It's a technical interview cheat sheet in its own regard with
What are Load Balancers?
Load balancers help distribute incoming traffic so the system can maximize its total capacity while decreasing queuing time. They're an integral part of successful software development.
These become even more important as a system scales and handles larger amounts of traffic.
It is best to use load balancers during your interviews if you believe your system requires more capacity, especially as it scales.
In many cases, are positioned in between the external traffic and the servers of the application.
Time and Space Complexity
What is Time and Space Complexity?
There are usually many ways to solve coding problems. But not every solution is created equally.
Good software development is defined by algorithms that are both efficient and practical. So, comparing the performance of different solutions will be a fundamental part of your coding interviews.
The time complexity of a program refers to how long an algorithm takes to run based on the input length.
Time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the length of the input.
The space complexity refers to how much memory an algorithm needs to process that same input.
How to Learn More About Time and Space Complexity Algorithms
What Programming Language to Use in a Technical Interview?
It doesn't matter what language you use in a coding interview. You should use whatever programming language you know in and out.
A dynamic language boasts compact syntax, makes it easier to type code, and features hash and list literals.
Whatever language you decide to work in, be sure to mention other languages you're fluent in to your interviewer. Tech company engineering managers want team members who are flexible and dynamic.
Expressing fluency in lower-level languages like C, C++, Rust, or even Go can help you stand out among other software engineers applying.
We recommend avoiding Java, C#, and PHP in your interview though. Interestingly, Triplebyte discovered that candidates who used these languages advanced in the interview process at lower rates.
Top tech company culture emphasizes adaptability and technical knowledge. Showcase the programming languages you know well and mention the ones you've built other projects with.
Successful software developers are often tinkering on side projects in languages they don't yet know to keep their skills sharp.
What you SHOULD DO in a Technical Interview
- Use clean code: Your variable names should all be easily identifiable, etc.
- Don't type too quickly: Going too fast may confuse your interviewer on what you're building.
- Save time: Ask your interviewer if you can use trivial functions. This will save you some time.
- Clarify: Technical interview questions may or may not be designed to trick you! Ask your interviewer to clarify anything you don't completely understand.
- Whiteboard management: Whiteboard space management skills are a must! Keep your thoughts clear and easy to understand. Tech companies want to know that you've thought through multiple scenarios before blurting out an answer!
What NOT to Do in Your Coding Interview
- Don't copy and paste code without discussing it with your interviewer. You may miss variables that need to be renamed, etc.
- Don't ignore tips your interviewer might give you. If they stop your coding, they may have valuable insights to help you in the interview process.
- Don't keep your lips sealed! Talk through your thought process out loud so it's clear you understand what you're doing.
- Don't use strange or obscure variable names. Your variables should be easy to understand and follow.
- Don't have our cheat sheet open in another tab!
What Should You do After the Coding Interview Is Over?
All software engineers get nervous during a coding interview. It's natural, and to be expected.
In fact, we'd be surprised if you WEREN'T curious about how your coding skills looked in the technical interview.
After your interview is over, here's what you should do:
- Thank the interviewer for their time.
- Ask if they have any other questions about the project you worked on, or why you made certain technical decisions while coding.
- Ask them what to expect next in the interview process. Or you can use our company interview guides to get the inside-scoop before you even start.
- Send a follow-up email thanking them again for their time.
- If you don't get the job, ask if there any objective feedback they could share. You can use this to help you in your next technical interview!
(Even More) Coding Interview Practice Questions
- Design a fire alarm for the deaf.
- Write a pair of functions to serialize and deserialize a list of strings.
- Store a list of numbers as a single number.
- Given an nxn grid of 1 and 0s, return the number of islands in the input.
- Merge K sorted linked lists.
- Find Triplet with given sum in an array (3-sum)
- How does an HTTP request work?
- Sort a binary array in linear time.
Software Engineering Interview Resources
As you can imagine, you'll need more than this cheat sheet to set yourself up for the best success in your upcoming interview.
But don't fret. Here at Exponent, we have numerous different interview resources that will help put you in the best possible position to ace your software engineer interview:
💬 Practice with sample Software Engineer interview questions
📖 Read through our Software Engineering interview guides
👯♂️ Rehearse your behavioral and interpersonal skills with our interview practice tool.
👨🎓 Take our complete Software Engineering interview course.