This repository provides a curated list of algorithm techniques along with associated practice problems to help you master common patterns used in coding interviews and competitive programming.
- Sorting:
- QuickSort: Efficient average-case time complexity (O(nlog n)).
- MergeSort: Stable sort, useful when order matters (O(nlog n)).
- Searching:
- Binary Search: Fast search in sorted arrays (O(log n)).
- Two Pointers:
- In-place manipulation, often for sorted arrays (e.g., removing duplicates).
- Sliding Window:
- Subarray problems, finding maximum/minimum within a window.
- Traversal: Iterate through the list, understand the node structure.
- Insertion/Deletion: At beginning, end, or at a specific position.
- Reversal: In-place reversal, recursive and iterative approaches.
- Cycle Detection: Floyd's Tortoise and Hare algorithm.
- Understand how hash functions work.
- Insertion/Deletion/Lookup.
- Collision Handling.
- Traversal: Inorder, Preorder, Postorder (recursive and iterative).
- Searching: Find a node with a given value (especially in BSTs).
- Understand Push/Pop/Peek operations.
- Understand Enqueue/Dequeue operations.
- Operations: Insertion/Deletion (extract-min/max).
- Top K Elements: Using a heap to find k largest/smallest elements.
- Traversal: BFS, DFS.
- Shortest Path: Dijkstra's Algorithm.
- Cycle Detection: DFS.
- Implement Trie from scratch.
- Insertion/Searching: For words/prefixes.
- Autocompletion: Using a trie for word suggestions.
- Implement Union-Find from scratch.
- Find/Union operations.
- Cycle Detection in undirected graphs.
Defining a problem in terms of itself, often leading to elegant and concise solutions.
Breaking down a problem into overlapping subproblems and storing solutions to avoid recomputation.
Making locally optimal choices at each step with the hope of finding a global optimum.
Incrementally building solutions, exploring all possible paths, and abandoning invalid ones.
Begineer Friendly 100 Leetcode questions: here
S.N. | Problem Name | Difficulty Level | Solution | Leetcode Link |
---|---|---|---|---|
1 | Merge Intervals | Medium | Solution | Leetcode Link |
2 | Insert Interval | Medium | Solution | Leetcode Link |
3 | Number of Islands | Medium | DFS: Solution, BFS: Solution | Leetcode Link |
4 | Search Suggestions System | Medium | - | Leetcode Link |
5 | Best Time to Buy and Sell Stock | Easy | - | Leetcode Link |
6 | Group Anagrams | Medium | - | Leetcode Link |
7 | Longest Substring Without Repeating Characters | Medium | - | Leetcode Link |
8 | K Closest Points to Origin | Medium | - | Leetcode Link |
9 | Merge K Sorted Lists | Hard | - | Leetcode Link |
10 | Trapping Rain Water | Hard | - | Leetcode Link |
11 | 3Sum | Medium | - | Leetcode Link |
12 | Valid Parentheses | Easy | - | Leetcode Link |
13 | Word Ladder | Hard | - | Leetcode Link |
14 | Median of Two Sorted Arrays | Hard | - | Leetcode Link |
15 | Add Two Numbers | Medium | - | Leetcode Link |
16 | Word Search | Medium | - | Leetcode Link |
17 | Maximum Subarray | Easy | - | Leetcode Link |
18 | Merge Strings Alternately | Easy | Solution | Leetcode Link |
19 | Meeting Rooms II | Medium | Solution | Leetcode Link |
20 | Identify the Largest Outlier in an Array | Medium | Solution | Leetcode Link |
21 | Task Scheduler | Medium | Solution | Leetcode Link |
Best of Luck!