- A technique to solve problems is having two pointers starting at different positions and moving towards a condition.
- Useful for problems like finding a pair in a sorted array, or reversing a string in place.
- Used for solving matrix traversal problems like counting the number of islands in a grid.
- Often solved using DFS or BFS.
- Also known as the "Tortoise and Hare" approach.
- Commonly used to detect cycles in a linked list or to find the middle of the list.
- Useful for problems involving subarrays of a fixed size or maximum/minimum sum problems.
- Efficiently solve problems by sliding a window over the data.
- Merging overlapping intervals, typically used in scheduling and range-related problems.
- Often solved using sorting.
- https://www.youtube.com/playlist?list=PLamEquLLzOthgVHWr9GwyDFEHyxudZRtf
- LeetCode 56: Merge Intervals
- LeetCode 1288: Remove Covered Intervals
- Sorting an array of numbers when the numbers are in a specific range.
- Used for problems that involve finding missing or duplicate numbers.
- Reversing a linked list using constant space.
- Interview questions involving linked lists are commonly asked.
- Traversing a tree level by level.
- Useful for problems involving the shortest path in an unweighted graph.
- Traversing a tree by going deep along one branch before moving to another.
- Useful for problems like finding paths, tree diameter, etc.
- Technique for efficiently keeping track of the median of a stream of numbers.
- Uses a max heap and a min-heap.
- Finding all possible subsets of a given set.
- Can be solved using backtracking or iterative approaches.
- Binary search with variations to solve non-trivial searching problems.
- Examples include finding rotation points or closest elements in a sorted array.
- Finding the top K elements in a collection.
- Can be solved efficiently using heaps or quickselect.
- Bit manipulation technique.
- Useful for problems like finding missing numbers in an array.
- Try all possible solutions and backtrack once an invalid solution is reached.
- Commonly used in solving problems like Sudoku, N-Queens, etc.
- A dynamic programming problem involving maximizing value without exceeding weight.
- Uses a table to store intermediate results.
- Sorting directed graphs with dependencies.
- Used in problems involving course scheduling or task ordering.
- Merging K sorted lists into a single sorted list.
- Uses a min-heap for efficient merging.
- Stack used to maintain elements in a sorted order.
- Useful for solving problems involving the next greater or smaller element.
- Concurrently executing multiple threads for parallel computation.
- Helps in optimizing performance in multi-core systems.