0% found this document useful (0 votes)
930 views8 pages

Striver SDE Sheet

The document contains a list of 254 programming problems or concepts related to algorithms and data structures. Some of the problems involve arrays, strings, linked lists, stacks, queues, trees, graphs, sorting, searching, hashing, bit manipulation, greedy algorithms, dynamic programming and more. The list covers fundamental data structures and algorithms topics as well as more advanced problems like graphs, heaps, hash tables, and dynamic programming.

Uploaded by

johnhowardtest
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
930 views8 pages

Striver SDE Sheet

The document contains a list of 254 programming problems or concepts related to algorithms and data structures. Some of the problems involve arrays, strings, linked lists, stacks, queues, trees, graphs, sorting, searching, hashing, bit manipulation, greedy algorithms, dynamic programming and more. The list covers fundamental data structures and algorithms topics as well as more advanced problems like graphs, heaps, hash tables, and dynamic programming.

Uploaded by

johnhowardtest
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

8/27/22, 1:20 AM StriverList.

cpp

1 Count Digits
2 Reverse a Number
3 Check Palindrome
4 GCD Or HCF
5 Armstrong Numbers
6 Print all Divisors
7 Check for Prime
8 Understand recursion by print something N times
9 Print name N times using recursion
10 Print 1 to N using recursion
11 Print N to 1 using recursion
12 Sum of first N numbers
13 Factorial of N numbers
14 Reverse an array
15 Check if a string is palindrome or not
16 Fibonacci Number
17 Counting frequencies of array elements
18 Find the highest/lowest frequency element
19 Selection Sort
20 Bubble Sort
21 Insertion Sort
22 Merge Sort
23 Recursive Bubble Sort
24 Recursive Insertion Sort
25 Quick Sort
26 Largest Element in an Array
27 Second Largest Element in an Array without sorting
28 Check if the array is sorted
29 Remove duplicates from Sorted array
30 Left Rotate an array by one place
31 Left rotate an array by D places
32 Move Zeros to end
33 Linear Search
34 Find the Union and intersection of two sorted arrays
35 Find missing number in an array
36 Maximum Consecutive Ones
37 Subarray with given sum
38 Find the Missing Number
39 Find the number that appears once, and other numbers twice.
40 Search an element in a 2D matrix
41 Find the row with maximum number of 1’s
42 2Sum Problem
43 Sort an array of 0’s 1’s and 2’s
44 Majority Element (>n/2 times)
45 Kadane’s Algorithm, maximum subarray sum
46 Print subarray with maximum subarray sum (extended version of above problem)
47 Stock Buy and Sell
48 Rearrange the array in alternating positive and negative items
49 Next Permutation
50 Leaders in an Array problem
51 Longest Consecutive Sequence in an Array
52 Set Matrix Zeros
53 Rotate Matrix by 90 degrees
54 Print the matrix in spiral manner
55 Pascal’s Triangle
56 Majority Element (n/3 times)
57 3-Sum Problem
58 4-Sum Problem
59 Largest Subarray with 0 Sum

localhost:4649/?mode=clike 1/8
8/27/22, 1:20 AM StriverList.cpp

60 Count number of subarrays with given xor K


61 Merge Overlapping Subintervals
62 Merge two sorted arrays without extra space
63 Find the repeating and missing number
64 Count Inversions
65 Reverse Pairs
66 Maximum Product Subarray
67 Binary Search to find X in sorted array
68 Implement Lower Bound
69 Implement Upper Bound
70 Search Insert Position
71 Check if Input array is sorted
72 Find the first or last occurrence of a given number in a sorted array
73 Count occurrences of a number in a sorted array with duplicates
74 Find peak element
75 Search in Rotated Sorted Array I
76 Search in Rotated Sorted Array II
77 Find minimum in Rotated Sorted Array
78 Single element in a Sorted Array
79 Find kth element of two sorted arrays
80 Find out how many times has an array been rotated
81 Search in a 2 D matrix
82 Find Peak Element
83 Matrix Median
84 Find square root of a number in log n
85 Find the Nth root of a number using binary search
86 Koko Eating Bananas
87 Minimum days to make M bouquets
88 Find the smallest Divisor
89 Capacity to Ship Packages within D Days
90 Median of two sorted arrays
91 Aggressive Cows
92 Book Allocation Problem
93 Split array – Largest Sum
94 Kth Missing Positive Number
95 Minimize Max Distance to Gas Station
96 Median of 2 sorted arrays
97 Kth element of 2 sorted arrays
98 Remove outermost Paranthesis
99 Reverse words in a given string / Palindrome Check
100 Largest odd number in a string
101 Longest Common Prefix
102 Isomorphic String
103 check whether one string is a rotation of another
104 Check if two strings are anagram of each other
105 Sort Characters by frequency
106 Maximum Nesting Depth of Paranthesis
107 Roman Number to Integer and vice versa
108 Implement Atoi
109 Count Number of Substrings
110 Longest Palindromic Substring[Do it without DP]
111 Sum of Beauty of all substring
112 Reverse Every Word in A String
113 Introduction to LinkedList, learn about struct, and how is node represented
114 Inserting a node in LinkedList
115 Deleting a node in LinkedList
116 Find the length of the linkedlist [learn traversal]
117 Search an element in the LL
118 Introduction to DLL, learn about struct, and how is node represented
119 Insert a node in DLL
localhost:4649/?mode=clike 2/8
8/27/22, 1:20 AM StriverList.cpp

120 Delete a node in DLL


121 Reverse a DLL
122 Middle of a LinkedList [TortoiseHare Method]
123 Reverse a LinkedList [Iterative]
124 Reverse a LL [Recursive]
125 Detect a loop in LL
126 Find the starting point in LL
127 Length of Loop in LL
128 Check if LL is palindrome or not
129 Segrregate odd and even nodes in LL
130 Remove Nth node from the back of the LL
131 Delete the middle node of LL
132 Sort LL
133 Sort a LL of 0’s 1’s and 2’s by changing links
134 Find the intersection point of Y LL
135 Add 1 to a number represented by LL
136 Add 2 numbers in LL
137 Delete all occurrences of a key in DLL
138 Find pairs with given sum in DLL
139 Remove duplicates from sorted DLL
140 Reverse LL in group of given size K
141 Rotate a LL
142 Flattening of LL
143 Clone a Linked List with random and next pointer
144 Recursive Implementation of atoi()
145 Pow(x, n)
146 Count Good numbers
147 Sort a stack using recursion
148 Reverse a stack using recursion
149 Generate all binary strings
150 Generate Paranthesis
151 Print all subsequences/Power Set
152 Learn All Patterns of Subsequences (Theory)
153 Count all subsequences with sum K
154 Check if there exists a subsequence with sum K
155 Combination Sum
156 Combination Sum-II
157 Subset Sum-I
158 Subset Sum-II
159 Combination Sum – III
160 Letter Combinations of a Phone number
161 Palindrome Partitioning
162 Word Search
163 N Queen
164 Rat in a Maze
165 Word Break
166 M Coloring Problem
167 Sudoko Solver
168 Expression Add Operators
169 Introduction to Bit Manipulation [Theory]
170 Check if the i-th bit is set or not
171 Check if a number is odd or not
172 Check if a number is power of 2 or not
173 Count the number of set bits
174 Set/Unset the rightmost unset bit
175 Swap two numbers
176 Divide two integers without using multiplication, division and mod operator
177 Count number of bits to be flipped to convert A to B
178 Find the number that appears odd number of times
179 Power Set
localhost:4649/?mode=clike 3/8
8/27/22, 1:20 AM StriverList.cpp

180 Fnd xor of numbers from L to R


181 Find the two numbers appearing odd number of times
182 Print Prime Factors of a Number
183 All Divisors of a Number
184 Sieve of Eratosthenes
185 Find Prime Factorisation of a Number using Sieve
186 Power(n, x)
187 Implement Stack using Arrays
188 Implement Queue using Arrays
189 Implement Stack using Queue
190 Implement Queue using Stack
191 Implement stack using Linkedlist
192 Implement queue using Linkedlist
193 Check for balanced paranthesis
194 Implement Min Stack
195 Infix to Postfix Conversion using Stack
196 Prefix to Infix Conversion
197 Prefix to Postfix Conversion
198 Postfix to Prefix Conversion
199 Postfix to Infix
200 Convert Infix To Prefix Notation
201 Next Greater Element
202 Next Greater Element 2
203 Next Smaller Element
204 Number of NGEs to the right
205 Trapping Rainwater
206 Sum of subarray minimum
207 Stock span problem
208 Asteroid Collision
209 Sum of subarray ranges
210 Remove k Digits
211 Largest rectangle in a histogram
212 Maximal Rectangles
213 Sliding Window maximum
214 Stock Span Problem
215 The Celebrity Problem
216 Rotten Oranges
217 LRU cache (IMPORTANT)
218 LFU cache
219 Longest Substring Without Repeating Characters
220 Max Consecutive Ones III
221 Fruit Into Baskets
222 longest repeating character replacement
223 Binary subarray with sum
224 Count number of nice subarrays
225 Number of substring containing all three characters
226 Maximum point you can obtain from cards
227 Longest Substring with At Most K Distinct Characters
228 Subarray with k different integers
229 Minimum Window Substring
230 Minimum Window Subsequence
231 Problem 2
232 Introduction to Priority Queues using Binary Heaps
233 Min Heap and Max Heap Implementation
234 Check if an array represents a min-heap or not
235 Convert min Heap to max Heap
236 Kth largest element in an array [use priority queue]
237 Kth smallest element in an array [use priority queue]
238 Sort K sorted array
239 Merge M sorted Lists
localhost:4649/?mode=clike 4/8
8/27/22, 1:20 AM StriverList.cpp

240 Replace each array element by its corresponding rank


241 Task Scheduler
242 Hands of Straights
243 Design twitter
244 Connect `n` ropes with minimal cost
245 Kth largest element in a stream of running integers
246 Maximum Sum Combination
247 Find Median from Data Stream
248 K most frequent elements
249 Assign Cookies
250 Fractional Knapsack Problem
251 Greedy algorithm to find minimum number of coins
252 Lemonade Change
253 Valid Paranthesis Checker
254 N meetings in one room
255 Jump Game
256 Jump Game 2
257 Minimum number of platforms required for a railway
258 Job sequencing Problem
259 Candy
260 Program for Shortest Job First (or SJF) CPU Scheduling
261 Program for Least Recently Used (LRU) Page Replacement Algorithm
262 Insert Interval
263 Merge Intervals
264 Non-overlapping Intervals
265 Introduction to Trees
266 Binary Tree Representation in C++
267 Binary Tree Representation in Java
268 Binary Tree Traversals in Binary Tree
269 Preorder Traversal of Binary Tree
270 Inorder Traversal of Binary Tree
271 Post-order Traversal of Binary Tree
272 Level order Traversal / Level order traversal in spiral form
273 Iterative Preorder Traversal of Binary Tree
274 Iterative Inorder Traversal of Binary Tree
275 Post-order Traversal of Binary Tree using 2 stack
276 Post-order Traversal of Binary Tree using 1 stack
277 Preorder, Inorder, and Postorder Traversal in one Traversal
278 Height of a Binary Tree
279 Check if the Binary tree is height-balanced or not
280 Diameter of Binary Tree
281 Maximum path sum
282 Check if two trees are identical or not
283 Zig Zag Traversal of Binary Tree
284 Boundary Traversal of Binary Tree
285 Vertical Order Traversal of Binary Tree
286 Top View of Binary Tree
287 Bottom View of Binary Tree
288 Right/Left View of Binary Tree
289 Symmetric Binary Tree
290 Root to Node Path in Binary Tree
291 LCA in Binary Tree
292 Maximum width of a Binary Tree
293 Check for Children Sum Property
294 Print all the Nodes at a distance of K in a Binary Tree
295 Minimum time taken to BURN the Binary Tree from a Node
296 Count total Nodes in a COMPLETE Binary Tree
297 Requirements needed to construct a Unique Binary Tree | Theory
298 Link
299 Construct Binary Tree from inorder and preorder
localhost:4649/?mode=clike 5/8
8/27/22, 1:20 AM StriverList.cpp

300 Construct the Binary Tree from Postorder and Inorder Traversal
301 Serialize and deserialize Binary Tree
302 Morris Preorder Traversal of a Binary Tree
303 Morris Inorder Traversal of a Binary Tree
304 Flatten Binary Tree to LinkedList
305 Introduction to Binary Search Tree
306 Search in a Binary Search Tree
307 Find Min/Max in BST
308 Ceil in a Binary Search Tree
309 Floor in a Binary Search Tree
310 Insert a given Node in Binary Search Tree
311 Delete a Node in Binary Search Tree
312 Find K-th smallest/largest element in BST
313 Check if a tree is a BST or BT
314 LCA in Binary Search Tree
315 Construct a BST from a preorder traversal
316 Inorder Successor/Predecessor in BST
317 Merge 2 BST’s
318 Two Sum In BST | Check if there exists a pair with Sum K
319 Recover BST | Correct BST with two nodes swapped
320 Largest BST in Binary Tree
321 Graph and Types
322 Graph Representation | C++
323 Graph Representation | Java
324 Connected Components | Logic Explanation
325 BFS
326 DFS
327 Number of provinces (leetcode)
328 Connected Components Problem in Matrix
329 Rotten Oranges
330 Flood fill
331 Cycle Detection in unirected Graph (bfs)
332 Cycle Detection in undirected Graph (dfs)
333 0/1 Matrix (Bfs Problem)
334 Surrounded Regions (dfs)
335 Number of Enclaves [flood fill implementation – multisource]
336 Word ladder – 1
337 Word ladder – 2
338 Number of Distinct Islands [dfs multisource]
339 Bipartite Graph (DFS)
340 Cycle Detection in Directed Graph (DFS)
341 Topo Sort
342 Kahn’s Algorithm
343 Cycle Detection in Directed Graph (BFS)
344 Course Schedule – I
345 Course Schedule – II
346 Find eventual safe states
347 Alien dictionary
348 Shortest Path in UG with unit weights
349 Shortest Path in DAG
350 Djisktra’s Algorithm
351 Why priority Queue is used in Djisktra’s Algorithm
352 Shortest path in a binary maze
353 Path with minimum effort
354 Cheapest flights within k stops
355 Network Delay time
356 Number of ways to arrive at destination
357 Minimum steps to reach end from start by performing multiplication and mod
operations with array elements
358 Bellman Ford Algorithm
localhost:4649/?mode=clike 6/8
8/27/22, 1:20 AM StriverList.cpp

359 Floyd Warshal Algorithm


360 Find the city with the smallest number of neighbors in a threshold distance
361 Minimum Spanning Tree
362 Prim’s Algorithm
363 Disjoint Set [Union by Rank]
364 Disjoint Set [Union by Size]
365 Kruskal’s Algorithm
366 Number of operations to make network connected
367 Most stones removed with same rows or columns
368 Accounts merge
369 Number of island II
370 Making a Large Island
371 Swim in rising water
372 [HARD]
373 Bridges in Graph
374 Articulation Point
375 Kosaraju’s Algorithm
376 Dynamic Programming Introduction
377 Climbing Stars
378 Frog Jump(DP-3)
379 Frog Jump with k distances(DP-4)
380 Maximum sum of non-adjacent elements (DP 5)
381 House Robber (DP 6)
382 Ninja’s Training (DP 7)
383 Grid Unique Paths : DP on Grids (DP8)
384 Grid Unique Paths 2 (DP 9)
385 Minimum path sum in Grid (DP 10)
386 Minimum path sum in Triangular Grid (DP 11)
387 Minimum/Maximum Falling Path Sum (DP-12)
388 3-d DP : Ninja and his friends (DP-13)
389 Subset sum equal to target (DP- 14)
390 Partition Equal Subset Sum (DP- 15)
391 Partition Set Into 2 Subsets With Min Absolute Sum Diff (DP- 16)
392 Count Subsets with Sum K (DP – 17)
393 Count Partitions with Given Difference (DP – 18)
394 0/1 Knapsack (DP – 19)
395 Minimum Coins (DP – 20)
396 Target Sum (DP – 21)
397 Coin Change 2 (DP – 22)
398 Unbounded Knapsack (DP – 23)
399 Rod Cutting Problem | (DP – 24)
400 Longest Common Subsequence | (DP – 25)
401 Print Longest Common Subsequence | (DP – 26)
402 Longest Common Substring | (DP – 27)
403 Longest Palindromic Subsequence | (DP-28)
404 Minimum insertions to make string palindrome | DP-29
405 Minimum Insertions/Deletions to Convert String | (DP- 30)
406 Shortest Common Supersequence | (DP – 31)
407 Distinct Subsequences| (DP-32)
408 Edit Distance | (DP-33)
409 Wildcard Matching | (DP-34)
410 Best Time to Buy and Sell Stock |(DP-35)
411 Buy and Sell Stock – II|(DP-36)
412 Buy and Sell Stocks III|(DP-37)
413 Buy and Stock Sell IV |(DP-38)
414 Buy and Sell Stocks With Cooldown|(DP-39)
415 Buy and Sell Stocks With Transaction Fee|(DP-40)
416 Longest Increasing Subsequence |(DP-41)
417 Printing Longest Increasing Subsequence|(DP-42)
418 Longest Increasing Subsequence |(DP-43)
localhost:4649/?mode=clike 7/8
8/27/22, 1:20 AM StriverList.cpp

419 Largest Divisible Subset|(DP-44)


420 Longest String Chain|(DP-45)
421 Longest Bitonic Subsequence |(DP-46)
422 Number of Longest Increasing Subsequences|(DP-47)
423 Matrix Chain Multiplication|(DP-48)
424 Matrix Chain Multiplication | Bottom-Up|(DP-49)
425 Minimum Cost to Cut the Stick|(DP-50)
426 Burst Balloons|(DP-51)
427 Evaluate Boolean Expression to True|(DP-52)
428 Palindrome Partitioning – II|(DP-53)
429 Partition Array for Maximum Sum|(DP-54)
430 Maximum Rectangle Area with all 1’s|(DP-55)
431 Count Square Submatrices with All Ones|(DP-56)
432 Implement TRIE | INSERT | SEARCH | STARTSWITH
433 Implement Trie – 2 (Prefix Tree)
434 Longest String with All Prefixes
435 Number of Distinct Substrings in a String
436 Bit PreRequisites for TRIE Problems
437 Maximum XOR of two numbers in an array
438 Maximum XOR With an Element From Array
439 Minimum number of bracket reversals needed to make an expression balanced
440 Count and say
441 Hashing In Strings | Theory
442 Rabin Karp
443 Z-Function
444 KMP algo / LPS(pi) array
445 Shortest Palindrome
446 Longest happy prefix
447 Count palindromic subsequence in given string
448

localhost:4649/?mode=clike 8/8

You might also like