Featured Common DSA patterns
Sliding Window
Used for performing operations on a specific window size of an array or linked list, ...
Two Pointers or Iterators
Useful when searching pairs in a sorted array or linked list, often improving time an...
Fast and Slow Pointers
Also known as the Hare & Tortoise algorithm, useful for dealing with cyclic linked li...
Merge Intervals
An efficient technique to deal with overlapping intervals, useful for problems involv...
Cyclic Sort
An approach to deal with problems involving arrays containing numbers in a given rang...
In-place Reversal of Linked List
A pattern for reversing links between nodes of a linked list in-place, without using ...
Tree BFS (Breadth-First Search)
A technique for traversing a tree level-by-level, using a queue to keep track of node...
Tree DFS (Depth-First Search)
A pattern for traversing a tree using depth-first search, typically implemented using...
Two Heaps
An approach using two heaps (min and max) to efficiently find the smallest and bigges...
Subsets
An efficient Breadth-First Search approach to handle problems involving permutations ...
Modified Binary Search
An efficient way to handle problems involving binary search in sorted arrays, linked ...
Top K Elements
A pattern using heaps to solve problems involving finding the top/smallest/frequent '...
K-way Merge
A technique using a heap to efficiently perform sorted traversal of multiple sorted a...
Topological Sort
Used to find a linear ordering of elements that have dependencies on each other, ofte...