Algorithms you MUST know before the coding interviews

Lam Do
3 min readMar 21, 2021

In this article, I will give you three lists of algorithms you MUST know, SHOULD know, and good to know.

— — — — — — — — — — — — — — — — — — — — — — — — — —

TL;DR: You can jump to the next section :D

I am a Software Engineer at a FAANG company. Before that, I was studying in an unknown university in a developing country which is my hometown. However, Thanks to my expertise in algorithms, I received multiple job offers from FAANG companies. I also help other international students prepare for their coding interviews and then they got hired into BIG tech companies as well.

I know numerous people who are facing difficulties in rapidly acquiring a diverse range of algorithms, including foundational ones like Binary Search and Two Pointers, as well as more complex algorithms such as Dynamic Programming.

From my experience, it took me about 2 months to learn and solve almost ‘basic’ dynamic programming problems, but it took me more than 1 year to master this topic (meaning I can find out a solution for a new problem by myself). If you have only 6 months for the interview preparation, and you try to put all algorithms including Graph and Dynamic Programming (DP) into your head, it would be stressful.

Personally, I don’t think you have to learn all of them.

Because the chance of being asked DP in the interview is much smaller than the chance of being asked basic algorithms and data structures such as Two Pointers, Binary Search, Sorting, Tree Traversal… Furthermore, after some weeks learning DP, solving a problem that you have never met before is a rare thing (not impossible, just rare).

Instead of putting all the things into your head within a short period, my suggestion is to make sure you have a solid understanding of DS&A fundamentals.

— — — — — — — — — — — — — — — — — — — — — — — — — —

I hope this list will be helpful for you:

MUST learn: This list primarily covers the fundamental concepts of data structures and algorithms. If you are unfamiliar with the majority of these concepts, it may be wise to delay your interview.

  • Time complexity, Time complexity, Time complexity, Time complexity
  • Lots of people overlook it. They solely focus on solving problem. If you’re able to suggest a solution without evaluating its efficiency and complexities, what does that imply?

Data structures:

  • Array
  • Lists
  • String
  • Hash table
  • Map/Set

Algorithms:

  • Two pointers
  • Binary Search
  • Sorting algorithms
  • Searching algorithms
  • Recursion
  • Hashing algorithm

SHOULD learn: This list gives you necessary knowledge to optimize your solutions during coding interviews.

Data structures:

  • Stack
  • Queue
  • Heap
  • Tree

Algorithms:

  • BFS/ DFS (basic problems)
  • Backtracking
  • Greedy

Good to know: if you still have time (lots of time) or you have a strong DS&A fundamentals

  • Dynamic Programming
  • Graph algorithms such as Minimum Spanning Tree, Minimum Distance in graph,…
  • The list is endless! It goes on and on indefinitely….

There are some great online sources to start learning these things:

  • https://www.interviewbit.com/courses/programming/ — One website I really like and often recommend it to my friend. It organizes problems into categories based on their topics and patterns.
  • Geeks 4 Geeks — This website has a lot of examples of applications of Data Structures and algorithms that you would find for interviews.

Hope this short article can give you an overview of essential algorithms and data structures you should learn to rock the coding interviews.

--

--

Lam Do

Each experience is unique and I love capturing it