8 Patterns Review For Successful Coding Interview

8 Patterns Review For Successful Coding Interview

This is nothing but quick 5 min revision before going to interview.

  1. Two Pointers
    • Use 2 pointer : startPointer=0 & endPointer=len(inputs)-1
    • Traverse towards the middle
    • Increment start pointer and decrement end pointer based on problem condition mention in question.
    • Two Pointers Practice Questions: (Easy, Top Interview Questions)
  2. Modified Binary Search
  3. Binary Tree BFS
  4. Binary Tree DFS
  5. Topological Sort
    • A topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph (DAG).
    • Topological Practice Questions: (Easy, Top Interview Questions)
  6. Top K Elements
    • Use Min Heap which will always have size k
    • At the insertion,
      • check if size of min heap is greater than k (k+1), remove root element and then you will have min heap of size k always
    • Top K Practice Questions: (Easy, Top Interview Questions)
  7. Subset
  8. Sliding window

Visit https: https://codeandalgo.com for more such contents

Leave a Reply

Your email address will not be published. Required fields are marked *