DEV Community

Pritam Chougale
Pritam Chougale

Posted on

What are some must-know algorithms to crack FAANG interviews?

Going by our experience of training thousands of students at Programming Pathshala and helping them get successfully placed in these companies, the most important algorithms you need to cover for any major tech company are -

1. Precomputation Techniques: Many people do not consider them as important but they are extremely crucial. Many problems have prefix/suffix computations as an important step of optimisation.

2. Binary Search Algorithm: Binary search is not as simple as finding an element in a sorted array. It has much more complicated use cases which is important to know and work on. Concepts of monotonic functions and binary search on answer help you appreciate the beauty of this simple algorithm and make you a good problem solver.

3. Sorting Algorithms: Knowing different sorting algorithms like Bubble, Insertion, Selection, Merge, Quick and many more O(n) sorts is important. Also, these algorithms have associated techniques like Divide and Conquer in Merge and Quick Sort, Dutch National Flag problem, etc which are also important.

4.Two Pointers & Sliding Window: Two Pointer Approach is optimised Binary Search Approach in 90% of the cases. Optimising binary search solutions by using 2 Pointers is an important step asked in many interviews.

5.Greedy Algorithms: This is the most difficult algorithm to spot in a problem. Getting to know that a problem can be solved by a particular greed and proving it is very difficuly. Proof by induction, contradiction and mathematical proofs come handy for these problems.

6.Recursion, Backtracking and Dynamic Programming: I have clubbed them together because you can’t do Dynamic Programming without fully understanding Recursion & Backtracking. Understand concepts of Recurrence Relation, Stack and Tree Diagrams, Concept of Memoization, state, etc. Many people start solving DP without understanding the theory. This is one topic where if you are clear with the theory, you will not be stuck in many problems.

7.Graph Search Algorithms: No fancy Djikstra or Flow Algorithms. No fancy Segment Trees. The most important is mastering the two search algorithms - Depth First Search and Breadth First Search in detail.

There are other less important algorithms like Bit Manipulation, Mathematical Algorithms and other subjects that you also need to cover for these interviews (Data Structures, OOPs, OS, DBMS, etc.) For complete syllabus, you can go through our website.

Most important thing to note is “Focus more on covering every aspect of an algorithm you are learning and understand the patterns associated with it. Do not unnecessarily go for heavy algorithms like segment tree. Stick to the basics and you should be good”

If you want to master Data structures and algorithms and become 100% coding interview ready I have a good new for you.
You can start a 7-days free trial of our coding interview prep platform. No credit card required.

Top comments (0)