This repository organizes common coding patterns used to solve algorithmic problems efficiently.
- Two Pointers
- Sliding Window
- Fast and Slow Pointers
- Merge Intervals
- Cyclic Sort
- In-place Reversal of Linked List
- Depth-First Search (DFS)
- Breadth-First Search (BFS)
- Topological Sort
- Binary Search
- Dynamic Programming
- Backtracking
- Bit Manipulation
- Greedy
- Subsets/Combinations/Permutations
The Two Pointers pattern is used when dealing with sorted arrays or linked lists to find a pair, triplet, or subarray that meets certain criteria (e.g., sum, length, duplicates).
Common Use Cases:
- Pair with target sum
- Remove duplicates
- Reverse an array in-place
- Compare strings/arrays (anagram, palindrome)
Example Problems:
- Reverse Array
- Two Sum II β Input array is sorted
- Remove Duplicates from Sorted Array
- Is Subsequence