โฆ๏ธ If we are dealing with top/maximum/minimum/closest โK' elements among 'N' elements, we will be using a Heap.
โฆ๏ธ If the given input is a sorted array or a list, we will either be using Binray Search or the Two Pointers.
โฆ๏ธ If we need to try all combinations (or permutations) of the input, we can either use Backtracking or Breadth First Search.
โฆ๏ธ Most of the questions related to Trees or Graphs can be solved either through Breadth First Search or Depth First Search.
โฆ๏ธ Every recursive solution can be converted to an iterative solution using a Stack.
โฆ๏ธ For a problem involving arrays, if there exists a solution in O(n^2)time and O(1) space, there must exist two other solutions: 1) Using a HashMap or a Set for O(n) time and O(n) space, 2) Using sorting for O(n log n) time and O(1) space.
โฆ๏ธ If a problem is asking for optimization (e.g., maximization or minimization), we will be using Dynamic Programming.
โฆ๏ธ If we need to find some common substring among a set of strings, we will be using a HashMap or a Trie.
โฆ๏ธ If we need to search/manipulate a bunch of strings, Trie will be the best data structure.
โฆ๏ธ If the problem is related to a LinkedList and we can't use extra space, then use the Fast & Slow Pointer approach.
10 Best Data Structure & Algorithms Courses to Crack Coding Interviews in 2023.
Are you preparing for Coding interviews in 2023? Here are the 10 Awesome online courses to crack your coding interviews.
A Thread ๐งต
1 Master the Coding Interview: Data Structures + Algorithms : In this Course you will learn how to tackle tricky questions from the interviewer with respect to complexity and improvement.