These are some must-know algorithms to crack FAANG interviews!

  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 difficult. 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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Programming Pathshala

Programming Pathshala

We are working to democratise access to Tech Education. We help students learn coding and be confident about themselves.