Popular DSA SheetPopular

Love Babbar

A topic-wise problem sheet with a broad set of interview-oriented questions.

232Problems
12Topics
StructuredLearning
Learning Path

Explore topics

12 sections

Problem Explorer

232

Practice in sequence.

01
Reverse the array
Arrays
GFG
02
Find the maximum and minimum element in an array
Arrays
GFG
03
Find the "Kth" max and min element of an array
Arrays
GFG
04
Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algorithm
Arrays
GFG
05
Move all the negative elements to one side of the array
Arrays
GFG
06
Find the Union and Intersection of two sorted arrays
Arrays
GFG
07
Write a program to cyclically rotate an array by one
Arrays
GFG
08
Find the largest sum contiguous subarray
Arrays
GFG
09
Minimise the maximum difference between heights
Arrays
GFG
10
Minimum number of jumps to reach the end of an array
Arrays
GFG
11
Find duplicate in an array of N+1 integers
Arrays
LC
12
Merge two sorted arrays without using extra space
Arrays
GFG
13
Kadane's Algorithm
Arrays
GFG
14
Merge Intervals
Arrays
LC
15
Next Permutation
Arrays
LC
16
Count Inversions
Arrays
GFG
17
Best Time to Buy and Sell Stock
Arrays
LC
18
Find all pairs in an integer array whose sum is equal to a given number
Arrays
GFG
19
Find common elements in three sorted arrays
Arrays
GFG
20
Rearrange the array in alternating positive and negative items with O(1) extra space
Arrays
GFG
21
Find if there is any subarray with sum equal to zero
Arrays
GFG
22
Find factorial of a large number
Arrays
GFG
23
Find maximum product subarray
Arrays
GFG
24
Find the longest consecutive subsequence
Arrays
GFG
25
Given an array of size n and a number k, find all elements that appear more than "n/k" times
Arrays
GFG
26
Maximum profit by buying and selling a share at most twice
Arrays
GFG
27
Find whether an array is a subset of another array
Arrays
GFG
28
Find the triplet that sums to a given value
Arrays
GFG
29
Trapping Rain Water
Arrays
LC
30
Chocolate Distribution Problem
Arrays
GFG
31
Find the smallest subarray with sum greater than a given value
Arrays
GFG
32
Three way partitioning of an array around a given value
Arrays
GFG
33
Minimum swaps required to bring elements less than or equal to K together
Arrays
GFG
34
Minimum number of operations required to make an array palindrome
Arrays
GFG
35
Median of two sorted arrays of equal size
Arrays
GFG
36
Median of two sorted arrays of different sizes
Arrays
GFG
37
Spiral traversal on a Matrix
Matrix
GFG
38
Search an element in a matrix
Matrix
GFG
39
Find median in a row wise sorted matrix
Matrix
GFG
40
Find row with maximum number of 1s
Matrix
GFG
41
Print elements in sorted order using row-column wise sorted matrix
Matrix
GFG
42
Maximum size rectangle in a binary matrix
Matrix
GFG
43
Find a specific pair in matrix
Matrix
GFG
44
Rotate matrix by 90 degrees
Matrix
GFG
45
Kth smallest element in a row-wise and column-wise sorted matrix
Matrix
GFG
46
Common elements in all rows of a given matrix
Matrix
GFG
47
Reverse a String
Strings
GFG
48
Check whether a String is Palindrome or not
Strings
GFG
49
Find duplicate characters in a string
Strings
GFG
50
Why are strings immutable in Java?
Strings
WEB
51
Write a code to check whether one string is a rotation of another
Strings
GFG
52
Check whether a string is a valid shuffle of two strings
Strings
GFG
53
Count and Say problem
Strings
LC
54
Find the longest palindromic substring
Strings
LC
55
Find Longest Recurring Subsequence in String
Strings
GFG
56
Print all subsequences of a string
Strings
GFG
57
Print all permutations of the given string
Strings
GFG
58
Split the binary string into two substrings with equal 0s and 1s
Strings
GFG
59
Word Wrap Problem
Strings
GFG
60
Edit Distance
Strings
LC
61
Find next greater number with the same set of digits
Strings
GFG
62
Balanced Parenthesis problem
Strings
GFG
63
Word Break Problem
Strings
LC
64
Rabin Karp Algorithm
Strings
GFG
65
KMP Algorithm
Strings
GFG
66
Convert a sentence into its equivalent mobile numeric keypad sequence
Strings
GFG
67
Minimum number of bracket reversals needed to make an expression balanced
Strings
GFG
68
Count all palindromic subsequences in a given string
Strings
GFG
69
Count the number of a given string in a 2D character array
Strings
GFG
70
Find first and last positions of an element in a sorted array
Searching & Sorting
GFG
71
Find a Fixed Point (Value equal to index) in a given array
Searching & Sorting
GFG
72
Search in a rotated sorted array
Searching & Sorting
LC
73
Find square root of an integer
Searching & Sorting
GFG
74
Maximum and minimum of an array using minimum number of comparisons
Searching & Sorting
GFG
75
Optimum location of point to minimize total distance
Searching & Sorting
GFG
76
Find the repeating and the missing element
Searching & Sorting
GFG
77
Find the majority element
Searching & Sorting
LC
78
Search in an array where adjacent elements differ by at most k
Searching & Sorting
GFG
79
Find a pair with a given difference
Searching & Sorting
GFG
80
Find four elements that sum to a given value
Searching & Sorting
GFG
81
Maximum sum such that no two elements are adjacent
Searching & Sorting
GFG
82
Count triplets with sum smaller than a given value
Searching & Sorting
GFG
83
Activity Selection Problem
Greedy
GFG
84
Job Sequencing Problem
Greedy
GFG
85
Huffman Coding
Greedy
GFG
86
Water Connection Problem
Greedy
GFG
87
Fractional Knapsack Problem
Greedy
GFG
88
Greedy Algorithm to find minimum number of coins
Greedy
GFG
89
Maximum trains for which stoppage can be provided
Greedy
GFG
90
Minimum Platforms Problem
Greedy
GFG
91
Buy Maximum Stocks if i stocks can be bought on i-th day
Greedy
GFG
92
Rat in a Maze Problem
Backtracking
GFG
93
Printing all solutions in N-Queen Problem
Backtracking
GFG
94
Word Break Problem using Backtracking
Backtracking
GFG
95
Remove Invalid Parentheses
Backtracking
LC
96
Sudoku Solver
Backtracking
LC
97
M Coloring Problem
Backtracking
GFG
98
Print all palindromic partitions of a string
Backtracking
GFG
99
Subset Sum Problem
Backtracking
GFG
100
The Knight's Tour Problem
Backtracking
GFG
101
Tug of War
Backtracking
GFG
102
Implement Stack from Scratch
Stacks & Queues
GFG
103
Implement Queue from Scratch
Stacks & Queues
GFG
104
Implement 2 stacks in an array
Stacks & Queues
GFG
105
Find the middle element of a stack
Stacks & Queues
GFG
106
Implement "N" stacks in an Array
Stacks & Queues
GFG
107
Check whether an expression has valid or balanced parentheses
Stacks & Queues
GFG
108
Reverse a String using Stack
Stacks & Queues
GFG
109
Design a Stack that supports getMin() in O(1) time and O(1) extra space
Stacks & Queues
GFG
110
Find the next Greater element
Stacks & Queues
GFG
111
The Celebrity Problem
Stacks & Queues
GFG
112
Arithmetic Expression Evaluation
Stacks & Queues
GFG
113
Evaluation of Postfix Expression
Stacks & Queues
GFG
114
Insert an element at the bottom of a stack without using another data structure
Stacks & Queues
GFG
115
Reverse a stack using recursion
Stacks & Queues
GFG
116
Sort a Stack using recursion
Stacks & Queues
GFG
117
Merge Overlapping Intervals
Stacks & Queues
LC
118
Largest Rectangular Area in Histogram
Stacks & Queues
GFG
119
Length of the Longest Valid Substring
Stacks & Queues
GFG
120
Expression contains redundant brackets or not
Stacks & Queues
GFG
121
Implement Stack using Queue
Stacks & Queues
GFG
122
Implement Stack using Deque
Stacks & Queues
GFG
123
Stack Permutations (Check if an array is stack permutation of another)
Stacks & Queues
GFG
124
Implement Queue using Stack
Stacks & Queues
GFG
125
Implement "n" queues in an array
Stacks & Queues
GFG
126
Implement a Circular Queue
Stacks & Queues
GFG
127
LRU Cache Implementation
Stacks & Queues
LC
128
Reverse a Queue using recursion
Stacks & Queues
GFG
129
Implement a Max Heap / Min Heap using arrays
Heap
GFG
130
Sort an Array using Heap (HeapSort)
Heap
GFG
131
Maximum of all subarrays of size k
Heap
GFG
132
K largest elements in an array
Heap
GFG
133
Kth smallest and largest element in an unsorted array
Heap
GFG
134
Merge K sorted arrays
Heap
GFG
135
Merge 2 Binary Max Heaps
Heap
GFG
136
Kth largest sum continuous subarrays
Heap
GFG
137
Reorganize String
Heap
LC
138
Merge K Sorted Linked Lists
Heap
LC
139
Smallest Range in K Lists
Heap
LC
140
Median in a Stream of Integers
Heap
GFG
141
Check if a Binary Tree is Heap
Heap
GFG
142
Connect N ropes with minimum cost
Heap
GFG
143
Convert BST to Min Heap
Heap
GFG
144
Convert Min Heap to Max Heap
Heap
GFG
145
Rearrange characters in a string so that no two adjacent are same
Heap
GFG
146
Minimum sum of two numbers formed from digits of an array
Heap
GFG
147
Count set bits in an integer
Bit Manipulation
GFG
148
Find the two non-repeating elements in an array of repeating elements
Bit Manipulation
GFG
149
Count number of bits to be flipped to convert A to B
Bit Manipulation
GFG
150
Count total set bits in all numbers from 1 to n
Bit Manipulation
GFG
151
Check whether a number is a power of two
Bit Manipulation
GFG
152
Find position of the only set bit
Bit Manipulation
GFG
153
Copy set bits in a range
Bit Manipulation
GFG
154
Divide two integers without using multiplication, division and mod operator
Bit Manipulation
LC
155
Calculate square of a number without using *, / and pow()
Bit Manipulation
GFG
156
Power Set
Bit Manipulation
GFG
157
Coin Change Problem
Dynamic Programming
LC
158
0/1 Knapsack Problem
Dynamic Programming
GFG
159
Binomial Coefficient Problem
Dynamic Programming
GFG
160
Permutation Coefficient Problem
Dynamic Programming
GFG
161
Program for nth Catalan Number
Dynamic Programming
GFG
162
Matrix Chain Multiplication
Dynamic Programming
GFG
163
Edit Distance
Dynamic Programming
LC
164
Subset Sum Problem
Dynamic Programming
GFG
165
Friends Pairing Problem
Dynamic Programming
GFG
166
Gold Mine Problem
Dynamic Programming
GFG
167
Assembly Line Scheduling Problem
Dynamic Programming
GFG
168
Painting the Fence Problem
Dynamic Programming
GFG
169
Maximize The Cut Segments
Dynamic Programming
GFG
170
Longest Common Subsequence
Dynamic Programming
LC
171
Longest Repeated Subsequence
Dynamic Programming
GFG
172
Longest Increasing Subsequence
Dynamic Programming
LC
173
Space Optimized Solution of LCS
Dynamic Programming
GFG
174
LCS (Longest Common Subsequence) of three strings
Dynamic Programming
GFG
175
Maximum Sum Increasing Subsequence
Dynamic Programming
GFG
176
Count all subsequences having product less than K
Dynamic Programming
GFG
177
Longest subsequence such that difference between adjacent is one
Dynamic Programming
GFG
178
Maximum subsequence sum such that no three are consecutive
Dynamic Programming
GFG
179
Egg Dropping Problem
Dynamic Programming
LC
180
Maximum Length Chain of Pairs
Dynamic Programming
GFG
181
Maximum size square sub-matrix with all 1s
Dynamic Programming
GFG
182
Maximum sum of pairs with specific difference
Dynamic Programming
GFG
183
Minimum Cost Path
Dynamic Programming
GFG
184
Construct a Trie from scratch
Trie
GFG
185
Find shortest unique prefix for every word in a given list
Trie
GFG
186
Word Break Problem using Trie
Trie
GFG
187
Given a sequence of words, print all anagrams together
Trie
GFG
188
Implement a Phone Directory
Trie
GFG
189
Print unique rows in a given boolean matrix
Trie
GFG
190
Create a Graph and print it
Graphs
GFG
191
Implement BFS algorithm
Graphs
GFG
192
Implement DFS algorithm
Graphs
GFG
193
Detect Cycle in Directed Graph using BFS/DFS
Graphs
GFG
194
Detect Cycle in Undirected Graph using BFS/DFS
Graphs
GFG
195
Search in a Maze
Graphs
GFG
196
Minimum Steps by Knight
Graphs
GFG
197
Flood Fill Algorithm
Graphs
LC
198
Clone a Graph
Graphs
LC
199
Making Wired Connections
Graphs
GFG
200
Word Ladder
Graphs
LC
201
Dijkstra Algorithm
Graphs
GFG
202
Implement Topological Sort
Graphs
GFG
203
Minimum time taken by each job to be completed given a Directed Acyclic Graph
Graphs
GFG
204
Find whether it is possible to finish all tasks from given dependencies
Graphs
GFG
205
Find the number of Islands
Graphs
GFG
206
Given a sorted Dictionary of an Alien Language, find order of characters
Graphs
GFG
207
Implement Kruskal's Algorithm
Graphs
GFG
208
Implement Prim's Algorithm
Graphs
GFG
209
Total number of spanning trees in a graph
Graphs
GFG
210
Implement Bellman Ford Algorithm
Graphs
GFG
211
Implement Floyd Warshall Algorithm
Graphs
GFG
212
Travelling Salesman Problem
Graphs
GFG
213
Graph Colouring Problem
Graphs
GFG
214
Snake and Ladders Problem
Graphs
GFG
215
Find Bridge in a Graph
Graphs
GFG
216
Count Strongly Connected Components using Kosaraju Algorithm
Graphs
GFG
217
Check whether a graph is Bipartite or Not
Graphs
GFG
218
Detect Negative Cycle in a Graph
Graphs
GFG
219
Longest Path in a Directed Acyclic Graph
Graphs
GFG
220
Journey to the Moon
Graphs
GFG
221
Cheapest Flights Within K Stops
Graphs
LC
222
Oliver and the Game
Graphs
GFG
223
Water Jug Problem using BFS
Graphs
GFG
224
Find if there is a path of more than k length from a source
Graphs
GFG
225
M-Colouring Problem
Graphs
GFG
226
Minimum edges to reverse to make path from source to destination
Graphs
GFG
227
Paths to travel each node using each edge (Seven Bridges)
Graphs
GFG
228
Vertex Cover Problem
Graphs
GFG
229
Chinese Postman / Route Inspection Problem
Graphs
WEB
230
Number of triangles in a directed and undirected graph
Graphs
GFG
231
Minimise the cashflow among a given set of friends
Graphs
GFG
232
Two Clique Problem
Graphs
GFG