Software Engineer Interview Preparation
A list of items that I consider indispensable for a good preparation for a job interview aiming at a Software Engineer position. Most of the technical questions will fall within the presented subjects.
1. Prepare your resume. Follow best practices from Career Cup. Design it towards the job posting, use the same keywords (e.g. “Web Application”, “React”, “DevOps”, “REST”, “CRUD”, an so on), as most non-technical recruiters aren't familiar with the underlying technologies and will just judge how your resume matches the job posting. Emphasize what your role and deliveries were, instead of trying to fully explain the project itself. Finally, ask peers to look at your resume to see if it sounds clear to other people.
- Estimating the worst-case time complexity of a piece of code. (Also called Big-O notation) e.g. O(n), O(n^2), O(n log n), O(log n), and so on.
- Sorting in O(n^2): Bubble Sort, Selection Sort, Insertion Sort. (Do not memorize, understand conceptually why they are O(n^2) and why they are bad.)
- Sorting in O(n log n): Merge Sort, Heap Sort, Quick Sort. (Do not memorize, understand Divide-and-Conquer and why that is better than O(n^2). Know how to call the sort function in your language of choice.)
- Sorting in O(n): Counting Sort, Bucket Sort. (Memorize in case a problem has the necessary constraints to be solved in O(n).)
- Elementary data structures: Stacks and Queues: Know wow to use them in your language of choice, worst-case complexities for each operation. Understand when to use queue-order -- First In, First Out or FIFO -- versus stack-order.
- Hash Maps or Dictionaries: How to use it in your language of choice, worst-case complexities of each operation.
- Heaps or Priority Queues: How to use it in your language of choice, worst-case complexities of each operation.
- Trees: How to represent in code, Heap property, Binary Search Trees property. (Do not memorize algorithms, but understand how element-level properties enforced recurisvely can achieve strutructure-level properties.)
- Searching in O(log n): finding an element in a Binary Search Tree, finding an element in a sorted list.
- Problem solving: Brute Force (how to exhaustively search the solution-space), Greedy (how to leverage a property to reach a quicker correct solution), Divide and Conquer (how to recursively break down a “macro” problem, solve each “micro” part, then merge the solutions together into the correct solution), Backtracking and Recursion (know how to traverse trees with both recursive functions an an explicit stack).
- Graphs: How to represent in code, Breadth-First Search, Depth-First Search. (Memorize in case a solution needs a graph traversal).
3. Read the book Cracking the Coding Interview by Gayle McDowell. You do not need to solve all problems, but make sure to read the full book up to the problem section so you understand the whole process and purpose of interviewing from both the interviewee and the interviewer point of views.
4. Practice mock interviews with peers. Use Pramp to find a practice partner and take turns interviewing. When interviewing, remember the goal is not always to reach the “correct” answer quickly, but to expose your thought process and rationale clearly to the interviewer. The usual script for a technical interview go like this:
- After the interviewer states the problem, always ask clarifying questions which could simplify the problem statement. (e.g. “Are all the numbers distinct or positive integers?”).
- After you fully understand the problem and the constraints, discuss the high-level algorithm with the interviewer. Do not go into the code until you both are fully aligned that a solution is correct and is fast enough (according to the worst-case time complexity).
- “Should I code?”. Ask you recruiter if you should start writing down the code for the solution. Explain as you go and expose your rationale in both the things you are doing and the things you are choosing not to do. (e.g. “Since I know the numbers are distinct according to the problem statement, then...”). Make sure to handle edge cases, such as null, negatives, zeroes, empty lists.
- After you finalize the solution and without the interviewer asking you to do it, “run” at least the “happy” case through it and explain how the program would execute step-by-step. Make sure to include some edge cases in the end. If there's not enough time, just mention which edge cases you would like to also test.
- After you're done, the interviewer can ask some follow up questions which you can answer conceptually. For example, “how would you handle if the numbers could be negative or repeated?”. Explain the needed changes and where your solution falls short in those cases.
- The Book Cracking the Coding Interview by Gayle McDowel.
- The website InterviewBit for practicing interview problems: https://www.interviewbit.com.
- The website Pramp for finding a partner for mock interviews: https://www.pramp.com.
- The website GeeksforGeeks for referencing subjects you need to learn: https://www.geeksforgeeks.org.
- The Book Introduction to Algorithm and Data Structures by Cormen is the definitive resource for most of the subjects above, but not very time-efficient. Read articles in GeeksforGeeks instead.