π― Goal: This isn't just another list. It's a strategically curated collection of ~100 high-impact Data Structures and Algorithms problems frequently encountered in interviews at MAANG (Meta, Apple, Amazon, Netflix, Google) and other top-tier tech companies. Master these, and you'll build the core problem-solving muscle needed to excel. πͺ
π‘ How This List Was Curated:
- Cross-Referencing: Problems selected appear consistently across highly respected resources like:
- LeetCode's "Top Interview Questions" (by frequency).
- Blind 75: A list crowdsourced from Blind (an anonymous professional network).
- NeetCode 150: A popular curated list covering essential patterns.
- Aggregated interview experiences shared on LeetCode Discuss, Glassdoor, and other platforms.
- Concept Coverage: Ensuring all fundamental DSA topics and common patterns are represented.
- MAANG+ Focus: Prioritizing question types and difficulties commonly reported in MAANG+ interviews.
- Community Validation: Incorporating problems widely recognized by the competitive programming and interview prep community.
Disclaimer: While based on extensive research and community data, exact interview questions vary. This list focuses on building the underlying skills tested by recurring problem patterns.
Click the links to jump to a section!
- π Array
- βοΈ String
- βοΈ Linked List
- βοΈ Two Pointers
- πΌοΈ Sliding Window
- π₯ Stack
- π³ Tree (BFS/DFS/Traversal)
- π² Tree (Advanced & BST)
- π₯ Heap / Priority Queue
- π Backtracking
- π» Dynamic Programming (1D)
- π§± Dynamic Programming (2D & Advanced)
- π Graph (BFS/DFS/Union-Find)
- πΊοΈ Graph (Advanced & Shortest Path)
- π Binary Search
- π‘ Greedy
- π Math & Bit Manipulation
- π§© Intervals
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
1 | β Two Sum | Hashing | The quintessential hash map problem. Checks basic data structure usage. | LC Top, Blind 75 | |
2 | β Best Time to Buy and Sell Stock | Sliding Window, Greedy | Simple optimization, finding min/max efficiently in one pass. | LC Top, Blind 75 | |
3 | Contains Duplicate | Hashing, Set | Basic set usage for uniqueness checks. | LC Top | |
4 | β Product of Array Except Self | Prefix/Suffix Products | Clever array manipulation without division. Tests thinking outside the box. | LC Top, Blind 75 | |
5 | β Maximum Subarray | Kadane's Algo, DP | The most famous DP intro problem (can be solved greedily). Fundamental pattern. | LC Top, Blind 75 | |
6 | Maximum Product Subarray | DP, Array Traversal | Variation of Max Subarray, handles negative numbers. Tests edge cases. | LC Top, Blind 75 | |
7 | Find Minimum in Rotated Sorted Array | Binary Search | Classic modified binary search on rotated arrays. | LC Top, Blind 75 | |
8 | β Search in Rotated Sorted Array | Binary Search | Extends the above, requires careful boundary condition handling. | LC Top, Blind 75 | |
9 | β 3Sum | Sorting, Two Pointers | Foundational k-sum problem. Tests handling duplicates and two-pointer technique. | LC Top, Blind 75 | |
10 | Container With Most Water | Two Pointers | Classic two-pointer optimization problem. | LC Top, Blind 75 | |
11 | Next Permutation | Array Manipulation | Understanding lexicographical order and in-place swaps. | LC Top | |
12 | Find the Duplicate Number | Cycle Detection (Floyd's) | Maps array problem to linked list cycle detection. Clever and efficient. | LC Top |
*Source Hint: Indicates sources where this problem is frequently listed (LC Top = LeetCode Top Interview Qs, Blind 75, NeetCode 150). This is indicative, not exhaustive.
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
13 | β Longest Substring Without Repeating Characters | Sliding Window, Hashing | The canonical sliding window problem. Tests efficient substring analysis. | LC Top, Blind 75 | |
14 | β Longest Repeating Character Replacement | Sliding Window, Hashing | Advanced sliding window requiring careful window condition management. | LC Top, Blind 75 | |
15 | β Minimum Window Substring | Sliding Window, Hashing | The definitive challenging sliding window problem. Tests complex state tracking. | LC Top, Blind 75 | |
16 | β Valid Anagram | Hashing, Sorting | Fundamental check for character counts. Basic but essential. | LC Top, Blind 75 | |
17 | β Group Anagrams | Hashing, Sorting | Grouping items based on a derived key (sorted string or char count). Common pattern. | LC Top, Blind 75 | |
18 | β Valid Parentheses | Stack | Classic stack application for matching pairs. | LC Top, Blind 75 | |
19 | β Valid Palindrome | Two Pointers, String | Basic two-pointer technique for symmetry checks, ignoring non-alphanumerics. | LC Top, Blind 75 | |
20 | β Longest Palindromic Substring | Expand Around Center, DP | Finding optimal substructures. Expand-around-center is often preferred. | LC Top, Blind 75 | |
21 | Palindromic Substrings | Expand Around Center, DP | Counting all palindromic substrings. Similar logic to #20 but counting instead of finding max. | LC Top, Blind 75 | |
22 | Encode and Decode Strings (Premium) | String Design, Delimiter | Practical problem often asked in system design contexts or phone screens. Tests edge cases. | Blind 75, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
23 | β Reverse Linked List | Iteration, Recursion | The absolute fundamental linked list manipulation. | LC Top, Blind 75 | |
24 | β Linked List Cycle | Floyd's Cycle Detection | Classic application of the Tortoise and Hare algorithm. | LC Top, Blind 75 | |
25 | β Merge Two Sorted Lists | Pointers, Iteration | Foundational merging logic, basis for Merge Sort. | LC Top, Blind 75 | |
26 | β Merge k Sorted Lists | Heap (Priority Queue), D&C | Scalable merging. Tests heap usage or divide-and-conquer approach. | LC Top, Blind 75 | |
27 | Remove Nth Node From End of List | Two Pointers (Fast/Slow) | Common two-pointer pattern for finding elements relative to the end. | LC Top, Blind 75 | |
28 | Reorder List | Find Middle, Reverse, Merge | Combines multiple core list operations. Good test of modular thinking. | LC Top, Blind 75 |
(Sections for Two Pointers, Sliding Window, Stack, Trees, Heap, Backtracking, DP, Graphs, Binary Search, Greedy, Math/Bit Manipulation, Intervals would follow a similar detailed format)
(Problems like 3Sum, Container With Most Water, Valid Palindrome are already listed, but this section could include others primarily solved with this technique if not covered elsewhere)
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
29 | Sort Colors | Two Pointers | Dutch National Flag problem. Efficient in-place partitioning. | LC Top | |
30 | Trapping Rain Water | Two Pointers, DP, Stack | Multiple solutions exist. Tests optimization and insights. | LC Top, NeetCode |
(Many already covered in Array/String sections, this ensures the pattern is highlighted)
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
31 | Permutation in String | Sliding Window, Hashing | Fixed-size window check using frequency maps. | LC Top, Blind 75 | |
32 | Best Time to Buy and Sell Stock | Sliding Window, Greedy | (Re-listed for pattern emphasis) Simple window optimization. | LC Top, Blind 75 | |
33 | Longest Substring Without Repeating Characters | Sliding Window, Hashing | (Re-listed) The classic dynamic window size problem. | LC Top, Blind 75 |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
34 | β Valid Parentheses | Stack | (Re-listed) Fundamental stack usage for matching. | LC Top, Blind 75 | |
35 | Min Stack | Stack Design | Designing a stack with O(1) min retrieval. Tests data structure design. | LC Top, NeetCode | |
36 | Evaluate Reverse Polish Notation | Stack | Direct stack application for expression evaluation. | LC Top | |
37 | Daily Temperatures | Monotonic Stack | Classic "next greater element" pattern using a monotonic stack. | LC Top, NeetCode | |
38 | Largest Rectangle in Histogram | Monotonic Stack | Challenging application of monotonic stack for area calculation. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
39 | β Maximum Depth of Binary Tree | DFS, Recursion | Basic recursive tree traversal. | LC Top, Blind 75 | |
40 | β Same Tree | DFS, Recursion | Basic structural comparison using recursion. | LC Top, Blind 75 | |
41 | β Invert Binary Tree | DFS/BFS, Recursion | Famous, simple tree manipulation via recursion or iteration. | LC Top, Blind 75 | |
42 | Subtree of Another Tree | DFS, Recursion | Recursive check involving a helper function for subtree matching. | LC Top, Blind 75 | |
43 | β Binary Tree Level Order Traversal | BFS, Queue | The canonical BFS application on trees. | LC Top, Blind 75 | |
44 | Binary Tree Right Side View | BFS, DFS | Variation of level order traversal (finding the last node at each level). | LC Top, NeetCode | |
45 | Diameter of Binary Tree | DFS, Recursion | Calculating longest path via recursive depth calculation. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
46 | β Lowest Common Ancestor of a Binary Search Tree | BST Properties, DFS | Utilizes BST properties for efficient LCA finding. | LC Top, Blind 75 | |
47 | β Validate Binary Search Tree | DFS, Recursion, Range | Checking BST validity requires passing down min/max constraints. Important detail. | LC Top, Blind 75 | |
48 | β Kth Smallest Element in a BST | Inorder Traversal, DFS | Leverages the inorder traversal property of BSTs. | LC Top, Blind 75 | |
49 | Construct Binary Tree from Preorder and Inorder Traversal | Recursion, Hashing | Classic tree construction problem using traversal properties. | LC Top, Blind 75 | |
50 | β Binary Tree Maximum Path Sum | DFS, Recursion | Tricky recursion where path can start/end anywhere. Requires careful state return. | LC Top, Blind 75 | |
51 | Serialize and Deserialize Binary Tree | DFS/BFS, String | Design problem involving tree representation as a string. Tests clear encoding/decoding. | LC Top, Blind 75 | |
52 | Implement Trie (Prefix Tree) | Trie, Design | Foundational for many string/dictionary problems. | LC Top, Blind 75 | |
53 | Design Add and Search Words Data Structure | Trie, DFS, Backtracking | Extends Trie with wildcard search. Tests recursive search logic. | LC Top, Blind 75 | |
54 | Word Search II | Trie, Backtracking, DFS | Combines Trie efficiency with grid backtracking. Highly practical. | LC Top, Blind 75 |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
55 | β Top K Frequent Elements | Hashing, Heap, QuickSelect | Finding most frequent items efficiently. Tests Heap or QuickSelect usage. | LC Top, Blind 75 | |
56 | Kth Largest Element in an Array | Heap, QuickSelect | Similar to Top K, focuses on finding the specific Kth element. | LC Top, NeetCode | |
57 | Find Median from Data Stream | Two Heaps (Max/Min) | Classic design problem using two heaps to maintain median in a streaming fashion. | LC Top, Blind 75 | |
58 | Merge k Sorted Lists | Heap (Priority Queue) | (Re-listed) Efficiently merging multiple lists using a min-heap. | LC Top, Blind 75 | |
59 | Task Scheduler | Greedy, Heap, Hashing | Scheduling tasks with cooldowns. Often solved greedily or with a max-heap. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
60 | β Subsets | Backtracking, Recursion | Generating all possible combinations (powerset). Foundational backtracking. | LC Top, Blind 75 | |
61 | Combination Sum | Backtracking, Recursion | Finding combinations that sum to a target (with repetition allowed). | LC Top, Blind 75 | |
62 | Permutations | Backtracking, Recursion | Generating all orderings of elements. | LC Top, Blind 75 | |
63 | Subsets II | Backtracking, Sorting | Subsets problem with duplicate elements. Requires handling duplicates carefully. | LC Top, NeetCode | |
64 | Combination Sum II | Backtracking, Sorting | Combination sum with duplicates, ensuring unique combinations. | LC Top, NeetCode | |
65 | β Word Search | Backtracking, DFS | Classic grid backtracking problem. Searching for a word in a 2D board. | LC Top, Blind 75 | |
66 | Letter Combinations of a Phone Number | Backtracking, Recursion | Mapping digits to letters and generating combinations. Common recursive structure. | LC Top, NeetCode | |
67 | N-Queens | Backtracking | Quintessential constraint satisfaction backtracking problem. | LC Top | |
68 | Palindrome Partitioning | Backtracking, DP | Partitioning a string into palindromic substrings. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
69 | β Climbing Stairs | DP (Fibonacci) | The introductory DP problem, equivalent to Fibonacci sequence. | LC Top, Blind 75 | |
70 | β Coin Change | DP (Unbounded Knapsack) | Classic DP problem for minimum coins. Tests state definition and transitions. | LC Top, Blind 75 | |
71 | β Longest Increasing Subsequence | DP, Binary Search | Fundamental subsequence problem. Can be optimized with Binary Search (patience sorting). | LC Top, Blind 75 | |
72 | β Word Break | DP, String | Checking if a string can be segmented using a dictionary. Common string DP. | LC Top, Blind 75 | |
73 | β House Robber | DP | Simple 1D DP with non-adjacent constraint. | LC Top, Blind 75 | |
74 | House Robber II | DP | Variation of House Robber with circular arrangement. Tests reducing to subproblems. | LC Top, Blind 75 | |
75 | Decode Ways | DP, String | Counting ways to decode a numeric string. Tests handling DP states carefully. | LC Top, Blind 75 | |
76 | Maximum Product Subarray | DP | (Re-listed) Requires tracking both max and min product ending at index i . |
LC Top, Blind 75 | |
77 | Partition Equal Subset Sum | DP (0/1 Knapsack) | Subset sum variation. Tests boolean DP state. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
78 | Unique Paths | DP (Grid) | Basic 2D DP on a grid. Calculating paths from top-left to bottom-right. | LC Top, Blind 75 | |
79 | Longest Common Subsequence | DP (2D String) | Fundamental DP problem for comparing two sequences. | LC Top, Blind 75 | |
80 | Edit Distance | DP (2D String) | Classic DP for string transformation distance (Levenshtein). | LC Top, NeetCode | |
81 | Best Time to Buy and Sell Stock with Cooldown | DP (State Machine) | Stock problem variation requiring state machine DP (buy, sell, cooldown). | LC Top, NeetCode | |
82 | Regular Expression Matching | DP, Recursion | Complex DP involving matching patterns with '.' and '*'. Tests careful state transitions. | LC Top | |
83 | Burst Balloons | DP (Interval) | Challenging interval DP. Requires thinking about the last operation. | LC Top, NeetCode | |
84 | Maximal Square | DP (Grid) | Finding the largest square of 1s in a binary matrix. Common 2D DP pattern. | LC Top |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
85 | β Number of Islands | BFS/DFS, Grid | The fundamental graph traversal problem on a grid. Counts connected components. | LC Top, Blind 75 | |
86 | β Clone Graph | BFS/DFS, Hashing | Deep copying graph structure. Tests handling visited nodes and recursion/iteration. | LC Top, Blind 75 | |
87 | Pacific Atlantic Water Flow | BFS/DFS, Grid | Multi-source traversal from oceans inward. Tests simultaneous graph traversals. | LC Top, Blind 75 | |
88 | β Course Schedule | Topological Sort (DFS/BFS) | Detecting cycles in a directed graph (prerequisite check). Essential pattern. | LC Top, Blind 75 | |
89 | Course Schedule II | Topological Sort | Finding a valid course order (if one exists). Extends Course Schedule I. | LC Top, NeetCode | |
90 | Number of Connected Components in an Undirected Graph (Premium) | Union-Find, BFS/DFS | Basic connectivity check, solvable efficiently with Union-Find. | Blind 75, NeetCode | |
91 | Graph Valid Tree (Premium) | Union-Find, BFS/DFS | Checking if a graph is a tree (connected and acyclic). Combines concepts. | Blind 75, NeetCode | |
92 | Redundant Connection | Union-Find | Finding the edge that creates a cycle in an undirected graph. Classic Union-Find. | NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
93 | β Word Ladder | BFS, Implicit Graph | Shortest path on an implicit graph where nodes are words and edges are transformations. | LC Top, Blind 75 | |
94 | Network Delay Time | Dijkstra's/Bellman-Ford, BFS | Shortest path from a source in a weighted directed graph (non-negative weights). | LC Top, NeetCode | |
95 | Cheapest Flights Within K Stops | Bellman-Ford / Modified Dijkstra | Shortest path with constraint on number of edges. Tests modified algorithms. | NeetCode | |
96 | Alien Dictionary (Premium) | Topological Sort, Graph Building | Deriving character order from a sorted list of words. Complex graph construction. | Blind 75, NeetCode | |
97 | Critical Connections in a Network | Tarjan's Algorithm (Bridges) | Finding bridges in a graph. Tests understanding of advanced graph algorithms. | NeetCode |
(Problems like Find Minimum in Rotated Sorted Array, Search in Rotated Sorted Array are already listed)
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
98 | β Binary Search | Binary Search | The core algorithm itself. Essential foundation. | LC Top | |
99 | Search a 2D Matrix | Binary Search | Applying binary search on a conceptually flattened sorted 2D matrix. | LC Top, Blind 75 | |
100 | Time Based Key-Value Store | Hashing, Binary Search | Searching for a value based on timestamp. Requires binary search on timestamps. | LC Top, Blind 75 | |
101 | β Median of Two Sorted Arrays | Binary Search | Advanced binary search on partitions to find the median efficiently. | LC Top, Blind 75 | |
102 | Koko Eating Bananas | Binary Search on Answer | Searching for the minimum speed (the answer) within a possible range. | NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
103 | β Maximum Subarray | Greedy (Kadane's) | (Re-listed) Can be solved optimally with a simple greedy approach (Kadane's). | LC Top, Blind 75 | |
104 | Jump Game | Greedy | Checking reachability by tracking the maximum reachable index greedily. | LC Top, Blind 75 | |
105 | Jump Game II | Greedy, BFS | Finding the minimum jumps. Can be solved greedily or viewed as a BFS level order. | LC Top, NeetCode | |
106 | Gas Station | Greedy | Classic greedy problem proving existence and finding a valid starting point. | LC Top, NeetCode | |
107 | Hand of Straights | Greedy, Hashing | Forming consecutive groups greedily using counts. | NeetCode | |
108 | Merge Triplets to Form Target Triplet | Greedy | Simple greedy check if the target triplet can be formed by valid merges. | NeetCode | |
109 | Partition Labels | Greedy, Two Pointers | Finding the smallest partitions such that each letter appears in at most one part. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
110 | Number of 1 Bits | Bit Manipulation | Basic bit counting (Hamming weight). | LC Top, Blind 75 | |
111 | Counting Bits | Bit Manipulation, DP | Calculating bits for numbers 0 to n efficiently, often using DP relation. | LC Top, Blind 75 | |
112 | Reverse Bits | Bit Manipulation | Reversing the bits of an integer. Tests careful bit shifting and masking. | LC Top, Blind 75 | |
113 | Missing Number | Bit Manipulation (XOR), Math | Finding the missing number in a range using XOR properties or sum formula. | LC Top, Blind 75 | |
114 | β Sum of Two Integers | Bit Manipulation | Adding numbers without using + or - . Tests understanding of bitwise addition. |
LC Top, Blind 75 | |
115 | Reverse Integer | Math, Overflow Check | Reversing digits of an integer while handling potential overflow. | LC Top | |
116 | Pow(x, n) | Recursion, Math | Efficient exponentiation using recursion (exponentiation by squaring). | LC Top | |
117 | Rotate Image | Math, Matrix | Rotating a matrix in-place. Tests index manipulation and layer-by-layer approach. | LC Top, NeetCode | |
118 | Spiral Matrix | Matrix Traversal | Traversing a matrix in a spiral pattern. Tests boundary and direction handling. | LC Top, NeetCode | |
119 | Set Matrix Zeroes | Matrix, Space Optimization | Setting rows/columns to zero efficiently, often using O(1) extra space. | LC Top, NeetCode |
# | Problem | Difficulty | Concepts | Why MAANG+ Loves It | Source Hint* |
---|---|---|---|---|---|
120 | β Insert Interval | Interval Merging | Inserting a new interval into sorted, non-overlapping intervals and merging. | LC Top, Blind 75 | |
121 | β Merge Intervals | Sorting, Intervals | The canonical interval merging problem after sorting by start time. | LC Top, Blind 75 | |
122 | β Non-overlapping Intervals | Greedy, Sorting | Finding minimum removals to make intervals non-overlapping. Classic greedy choice. | LC Top, Blind 75 | |
123 | Meeting Rooms (Premium) | Sorting, Intervals | Checking if a person can attend all meetings (no overlaps). Basic interval check. | Blind 75, NeetCode | |
124 | β Meeting Rooms II (Premium) | Heap, Sorting | Finding the minimum number of rooms required. Tests heap or sweep-line logic. | Blind 75, NeetCode | |
125 | Minimum Interval to Include Each Query | Heap, Sorting, Sweep Line | Advanced interval problem requiring efficient querying using heaps and sorting. | NeetCode |
This list covers a broad spectrum of DSA patterns essential for MAANG+ interviews.
- Understand the Core Concept: Don't just memorize solutions. Understand why a particular approach works (e.g., why use a heap for Kth largest? Why is Kadane's greedy?).
- Practice Variations: Once you solve a problem, think about variations (e.g., different constraints, follow-up questions).
- Time Yourself: Simulate interview conditions. Can you solve medium problems within 20-30 minutes?
- Explain Your Thought Process: Practice articulating your solution clearly, step-by-step. This is crucial in interviews.
- Review Regularly: Spaced repetition helps solidify concepts.
Good luck with your preparation! You've got this! π
Found an issue? Think a critical problem is missing? We welcome Pull Requests and Issues! Please check our (optional) CONTRIBUTING.md
guide for details. Let's make this the best resource for everyone!
If this repository helps you, please give it a β! Share it with fellow engineers preparing for interviews.