Popular DSA SheetPopular

Arsh Goyal

A structured collection of DSA problems with a strong interview and company-oriented focus.

295Problems
16Topics
StructuredLearning
Learning Path

Explore topics

16 sections

Problem Explorer

295

Practice in sequence.

01
Find the Duplicate Number
Arrays
LC
02
Sort Colors
Arrays
LC
03
Remove Duplicates from Sorted Array
Arrays
LC
04
Set Matrix Zeroes
Arrays
LC
05
Move Zeroes
Arrays
LC
06
Best Time to Buy and Sell Stock
Arrays
LC
07
Chocolate Distribution Problem
Arrays
GFG
08
Two Sum
Arrays
LC
09
Best Time to Buy and Sell Stock II
Arrays
LC
10
Subarray Sums Divisible by K
Arrays
LC
11
Find All Duplicates in an Array
Arrays
LC
12
Container With Most Water
Arrays
LC
13
3Sum
Arrays
LC
14
4Sum
Arrays
LC
15
Maximum Points You Can Obtain from Cards
Arrays
LC
16
Subarray Sum Equals K
Arrays
LC
17
Spiral Matrix
Arrays
LC
18
Word Search
Arrays
LC
19
Jump Game
Arrays
LC
20
Merge Sorted Array
Arrays
LC
21
Majority Element
Arrays
LC
22
Reverse Pairs
Arrays
LC
23
All combinations of size r from an array
Arrays
GFG
24
Game of Life
Arrays
LC
25
Max Value of Equation
Arrays
LC
26
Insert Delete GetRandom O(1) - Duplicates allowed
Arrays
LC
27
Largest Rectangle in Histogram
Arrays
LC
28
Valid Parentheses
Strings
LC
29
Print all the duplicate characters in a string
Strings
GFG
30
Find the Index of the First Occurrence in a String
Strings
LC
31
Longest Common Prefix
Strings
LC
32
Valid Palindrome II
Strings
LC
33
Integer to Roman
Strings
LC
34
Generate Parentheses
Strings
LC
35
Simplify Path
Strings
LC
36
Smallest window in a string containing all the characters of another string
Strings
GFG
37
Reverse Words in a String
Strings
LC
38
Rabin-Karp Algorithm for Pattern Searching
Strings
GFG
39
Group Anagrams
Strings
LC
40
Word Wrap
Strings
GFG
41
Basic Calculator II
Strings
LC
42
Valid Number
Strings
LC
43
Integer to English Words
Strings
LC
44
Minimum Window Substring
Strings
LC
45
Text Justification
Strings
LC
46
Boyer Moore Algorithm for Pattern Searching
Strings
GFG
47
Distinct Subsequences
Strings
LC
48
Maximum Area Rectangle of 1s in a Binary Matrix
Matrix Problems
GFG
49
Number of Islands
Matrix Problems
GFG
50
Given a matrix of 'O' and 'X', replace 'O' with 'X' if surrounded by 'X'
Matrix Problems
GFG
51
Rotate Image
Matrix Problems
LC
52
Minimum Moves to Equal Array Elements
Mathematical Problems
LC
53
Add Binary
Mathematical Problems
LC
54
Maximum Product of Three Numbers
Mathematical Problems
LC
55
Excel Sheet Column Title
Mathematical Problems
LC
56
Happy Number
Mathematical Problems
LC
57
Palindrome Number
Mathematical Problems
LC
58
Missing Number
Mathematical Problems
LC
59
Reverse Integer
Mathematical Problems
LC
60
Power of Two
Mathematical Problems
LC
61
Max Points on a Line
Mathematical Problems
LC
62
Valid Square
Mathematical Problems
LC
63
The kth Factor of n
Mathematical Problems
LC
64
Permutation Pair Sum
Sorting and Searching
GFG
65
Ceiling in a sorted array
Sorting and Searching
GFG
66
Pair with the given difference
Sorting and Searching
GFG
67
Check if reversing a sub array make the array sorted
Sorting and Searching
GFG
68
Radix Sort
Sorting and Searching
GFG
69
Product of Array Except Self
Sorting and Searching
GFG
70
Make all array elements equal with minimum cost
Sorting and Searching
GFG
71
Find Peak Element
Sorting and Searching
LC
72
Allocate Minimum Pages
Sorting and Searching
GFG
73
Minimum swaps to sort an array
Sorting and Searching
GFG
74
Aggressive cows
Sorting and Searching
WEB
75
Search in Rotated Sorted Array
Sorting and Searching
LC
76
Count of Smaller Numbers After Self
Sorting and Searching
LC
77
Split Array Largest Sum
Sorting and Searching
LC
78
Middle of the Linked List
Linked List
LC
79
Linked List Cycle
Linked List
LC
80
Convert Binary Number in a Linked List to Integer
Linked List
LC
81
Remove Duplicates from Sorted List
Linked List
LC
82
Sort a linked list of 0s, 1s and 2s
Linked List
GFG
83
Remove Linked List Elements
Linked List
LC
84
Merge Two Sorted Lists
Linked List
LC
85
Multiply two numbers represented by Linked Lists
Linked List
GFG
86
Intersection of Two Linked Lists
Linked List
LC
87
Delete without head pointer
Linked List
GFG
88
Palindrome Linked List
Linked List
LC
89
Reverse Linked List
Linked List
LC
90
Add Two Numbers
Linked List
LC
91
Copy List with Random Pointer
Linked List
LC
92
Add Two Numbers II
Linked List
LC
93
Reverse Linked List II
Linked List
LC
94
Reorder List
Linked List
LC
95
Remove Nth Node From End of List
Linked List
LC
96
Flatten a Multilevel Doubly Linked List
Linked List
LC
97
Partition List
Linked List
LC
98
Remove Duplicates from Sorted List II
Linked List
LC
99
Rearrange a Linked List in Zig-Zag fashion
Linked List
GFG
100
Sort List
Linked List
LC
101
Segregate even and odd nodes in a Linked List
Linked List
GFG
102
Rearrange a given linked list in-place
Linked List
GFG
103
Merge k Sorted Lists
Linked List
LC
104
Reverse Nodes in k-Group
Linked List
LC
105
Merge Sort for Linked Lists
Linked List
GFG
106
Flattening a Linked List
Linked List
GFG
107
Subtract Two Numbers represented as Linked Lists
Linked List
GFG
108
Implement Queue using Stacks
Stacks and Queues
LC
109
Backspace String Compare
Stacks and Queues
LC
110
Implement Stack using Queues
Stacks and Queues
LC
111
Implement Stack and Queue using Deque
Stacks and Queues
GFG
112
Next Greater Element I
Stacks and Queues
LC
113
Evaluation of Postfix Expression
Stacks and Queues
GFG
114
Implement two Stacks in an Array
Stacks and Queues
GFG
115
Minimum Cost Tree From Leaf Values
Stacks and Queues
LC
116
Daily Temperatures
Stacks and Queues
LC
117
Distance of nearest cell having 1
Stacks and Queues
GFG
118
Online Stock Span
Stacks and Queues
LC
119
Rotten Oranges
Stacks and Queues
GFG
120
Sum of Subarray Minimums
Stacks and Queues
LC
121
Evaluate Reverse Polish Notation
Stacks and Queues
LC
122
Gas Station
Stacks and Queues
GFG
123
Remove All Adjacent Duplicates in String II
Stacks and Queues
LC
124
Flatten Nested List Iterator
Stacks and Queues
LC
125
Max of Mins for All Window Sizes
Stacks and Queues
GFG
126
Introduction to LRU Cache
Stacks and Queues
GFG
127
The Celebrity Problem
Stacks and Queues
GFG
128
Diameter of Binary Tree
Trees
LC
129
Invert Binary Tree
Trees
LC
130
Subtree of Another Tree
Trees
LC
131
Range Sum of BST
Trees
LC
132
Symmetric Tree
Trees
LC
133
Convert Sorted Array to Binary Search Tree
Trees
LC
134
Merge Two Binary Trees
Trees
LC
135
Maximum Depth of Binary Tree
Trees
LC
136
Binary Tree Paths
Trees
LC
137
Same Tree
Trees
LC
138
Lowest Common Ancestor of a Binary Search Tree
Trees
LC
139
Path Sum
Trees
LC
140
Minimum Absolute Difference in BST
Trees
LC
141
Sum of Left Leaves
Trees
LC
142
Balanced Binary Tree
Trees
LC
143
Predecessor and Successor
Trees
GFG
144
Binary Tree Inorder Traversal
Trees
LC
145
BST with Dead End
Trees
GFG
146
Binary Search Tree Iterator
Trees
LC
147
Lowest Common Ancestor of a Binary Tree
Trees
LC
148
Unique Binary Search Trees II
Trees
LC
149
All Nodes Distance K in Binary Tree
Trees
LC
150
Validate Binary Search Tree
Trees
LC
151
Binary Tree Right Side View
Trees
LC
152
Redundant Connection
Trees
LC
153
Binary Tree Level Order Traversal
Trees
LC
154
Path Sum III
Trees
LC
155
Construct Binary Tree from Preorder and Postorder Traversal
Trees
LC
156
Unique Binary Search Trees
Trees
LC
157
Recover Binary Search Tree
Trees
LC
158
Populating Next Right Pointers in Each Node
Trees
LC
159
Flatten Binary Tree to Linked List
Trees
LC
160
Maximum Width of Binary Tree
Trees
LC
161
Min Distance Between Two in Binary Tree
Trees
GFG
162
Kth Smallest Element in a BST
Trees
LC
163
Binary Tree Zigzag Level Order Traversal
Trees
LC
164
Count BST Nodes in a Range
Trees
GFG
165
Preorder to BST
Trees
GFG
166
Binary Tree to DLL
Trees
GFG
167
Binary Tree Maximum Path Sum
Trees
LC
168
Sum of Distances in Tree
Trees
LC
169
Binary Tree Cameras
Trees
LC
170
Vertical Order Traversal of a Binary Tree
Trees
LC
171
Print all k-sum paths in a binary tree
Trees
GFG
172
Serialize and Deserialize Binary Tree
Trees
LC
173
Find median of BST
Trees
GFG
174
Largest BST in a Binary Tree
Trees
GFG
175
Construct BST from Preorder Traversal
Trees
GFG
176
BFS of graph
GRAPHS
GFG
177
Depth First Search or DFS for a Graph
GRAPHS
GFG
178
Number of Islands
GRAPHS
GFG
179
Flood Fill
GRAPHS
LC
180
Rat in a Maze
GRAPHS
GFG
181
Undirected Graph Cycle
GRAPHS
GFG
182
Detect Cycle in a Directed Graph
GRAPHS
GFG
183
Min Steps by Knight
GRAPHS
GFG
184
Decode String
GRAPHS
LC
185
Shortest Bridge
GRAPHS
LC
186
Number of Operations to Make Network Connected
GRAPHS
LC
187
Find Eventual Safe States
GRAPHS
LC
188
Count Strongly Connected
GRAPHS
GFG
189
Time Needed to Inform All Employees
GRAPHS
LC
190
Introduction to Graph Coloring
GRAPHS
GFG
191
Most Stones Removed with Same Row or Column
GRAPHS
LC
192
As Far from Land as Possible
GRAPHS
LC
193
Find the City With the Smallest Number of Neighbors at a Threshold Distance
GRAPHS
LC
194
Course Schedule I
GRAPHS
GFG
195
Prim's Algorithm for Minimum Spanning Tree (MST)
GRAPHS
GFG
196
Floyd Warshall
GRAPHS
GFG
197
Evaluate Division
GRAPHS
LC
198
Snakes and Ladders
GRAPHS
LC
199
Topological Sort
GRAPHS
GFG
200
Cheapest Flights Within K Stops
GRAPHS
LC
201
Detect Negative Cycle in Graph
GRAPHS
GFG
202
Check whether a given graph is Bipartite or not
GRAPHS
GFG
203
Longest Increasing Path in a Matrix
GRAPHS
LC
204
Making A Large Island
GRAPHS
LC
205
Remove Boxes
GRAPHS
LC
206
Critical Connections in a Network
GRAPHS
LC
207
Alien Dictionary
GRAPHS
GFG
208
The Water Jug Problem - Count Min Steps
GRAPHS
GFG
209
Travelling Salesman Problem
GRAPHS
GFG
210
Number of Spanning Trees in a Graph
GRAPHS
GFG
211
Word Ladder
GRAPHS
LC
212
Minimize Cash Flow
GRAPHS
GFG
213
Design Add and Search Words Data Structure
Tries
LC
214
Word Break Problem | (Trie solution)
Tries
GFG
215
Trie Data Structure
Tries
GFG
216
K Anagrams
Tries
GFG
217
Palindrome Pairs
Tries
LC
218
Phone Directory
Tries
GFG
219
Top K Frequent Elements
Heaps / PQs
LC
220
Kth Largest Element in an Array
Heaps / PQs
LC
221
Ugly Number II
Heaps / PQs
LC
222
Furthest Building You Can Reach
Heaps / PQs
LC
223
Kth Smallest Element in a Sorted Matrix
Heaps / PQs
LC
224
Reorganize String
Heaps / PQs
LC
225
Find the Most Competitive Subsequence
Heaps / PQs
LC
226
Smallest Positive Missing
Heaps / PQs
GFG
227
Largest subarray with 0 sum
Heaps / PQs
GFG
228
K Closest Points to Origin
Heaps / PQs
LC
229
Minimum Number of Refueling Stops
Heaps / PQs
LC
230
Minimum Cost to Hire K Workers
Heaps / PQs
LC
231
Swim in Rising Water
Heaps / PQs
LC
232
Sliding Window Maximum
Heaps / PQs
LC
233
Climbing Stairs
Dynamic Programming
LC
234
Maximum Product Subarray
Dynamic Programming
LC
235
Ones and Zeroes
Dynamic Programming
LC
236
Counting Bits
Dynamic Programming
LC
237
Knight Dialer
Dynamic Programming
LC
238
Maximize The Cut Segments
Dynamic Programming
GFG
239
Unique Paths
Dynamic Programming
LC
240
Minimum Path Sum
Dynamic Programming
LC
241
Coin Change
Dynamic Programming
LC
242
Decode Ways
Dynamic Programming
LC
243
Maximum Length of Repeated Subarray
Dynamic Programming
LC
244
Longest Increasing Subsequence
Dynamic Programming
LC
245
Longest Common Substring
Dynamic Programming
GFG
246
Count Square Submatrices with All Ones
Dynamic Programming
LC
247
Maximal Square
Dynamic Programming
LC
248
Mobile numeric keypad
Dynamic Programming
GFG
249
Weighted Job Scheduling
Dynamic Programming
GFG
250
Delete and Earn
Dynamic Programming
LC
251
Range Sum Query 2D - Immutable
Dynamic Programming
LC
252
Optimal Binary Search Tree
Dynamic Programming
GFG
253
Frog Jump
Dynamic Programming
LC
254
Best Time to Buy and Sell Stock IV
Dynamic Programming
LC
255
Minimum Insertion Steps to Make a String Palindrome
Dynamic Programming
LC
256
Largest area rectangular sub-matrix with equal number of 1's and 0's
Dynamic Programming
GFG
257
Trapping Rain Water
Dynamic Programming
LC
258
Minimum Cost to Merge Stones
Dynamic Programming
LC
259
Count Different Palindromic Subsequences
Dynamic Programming
LC
260
Maximal Rectangle
Dynamic Programming
LC
261
Burst Balloons
Dynamic Programming
LC
262
Super Egg Drop
Dynamic Programming
LC
263
Longest Repeating Character Replacement
Two Pointer Approach
LC
264
Maximum Number of Visible Points
Two Pointer Approach
LC
265
Gas Station
Greedy Algorithms
GFG
266
Minimum cost for acquiring all coins with k extra coins allowed with every coin
Greedy Algorithms
GFG
267
Restore the Array From Adjacent Pairs
Greedy Algorithms
LC
268
Task Scheduler
Greedy Algorithms
LC
269
Minimum Deletions to Make Character Frequencies Unique
Greedy Algorithms
LC
270
Remove K Digits
Greedy Algorithms
LC
271
Chocolate
Greedy Algorithms
WEB
272
Non-overlapping Intervals
Greedy Algorithms
LC
273
Minimum Time to Make Rope Colorful
Greedy Algorithms
LC
274
Minimum sum of two numbers formed from digits of an array
Greedy Algorithms
GFG
275
Combination Sum II
Backtracking
LC
276
Partition Equal Subset Sum
Backtracking
GFG
277
Combinations
Backtracking
LC
278
Subsets II
Backtracking
LC
279
M-Coloring Problem
Backtracking
GFG
280
Beautiful Arrangement
Backtracking
LC
281
Palindrome Partitioning
Backtracking
LC
282
Permutations II
Backtracking
LC
283
Word Search II
Backtracking
LC
284
Sudoku Solver
Backtracking
LC
285
N-Queens
Backtracking
LC
286
Unique Paths III
Backtracking
LC
287
Maximum number possible by doing at-most K swaps
Backtracking
GFG
288
Partition into k Equal Sum Subsets With Equal Sum
Backtracking
GFG
289
Equal Partition
Backtracking
GFG
290
Find paths from corner cell to middle cell in maze
Backtracking
GFG
291
Solving Cryptarithmetic Puzzles
Backtracking
GFG
292
Find all Palindromic Partitions of a String
Backtracking
GFG
293
Range Sum Query - Immutable
Segment Tree
LC
294
Range Sum Query - Mutable
Segment Tree
LC
295
Count of Range Sum
Segment Tree
LC