Striver SDE Sheet
Striver SDE Sheet
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
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
localhost:4649/?mode=clike 8/8