questions are one of the most asked coding interview questions in
coding
interviews of companies like Amazon, Microsoft, Media.net, Flipkart, etc,
and cover almost all of the concepts related to Data Structure &
Algorithms.
W h y trust the Striver SDE sheet?
This is sheet is prepared by Raj Vikramaditya A.K.A Striver, Candidate
Master, 6*, w ho has bagged offers from Google Warsaw, Facebook
London, Media.net(Directi). He has also interned at Amazon India. He is
also one of the top educators at Unacademy and was at GeeksforGeeks
as well. Not only this, hundreds of students cleared interviews of top
companies with the help of this sheet. What are you waiting for?
Disclaimer: Only start doing these problems if you feel you are
comfortable with solving the basic problems of DSA. Once you are, you
can start preparing for these problems, because these problems are solely
interview-based.
STRIVER SDE SHEET
D ay-1
Note: If you find the sheet useful, you can also contribute an article
or solution for any problem to be published on takeuforward.org!
Click here for more details.
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Set Matrix Zeros Coming Soon Click Youtube Code Code
2 Pascal Triangle Solution Click YouTube Code Code
3. Next Permutation Solution Click YouTube Code Code
4. Kadane’s Algorithm Coming Soon Click YouTube Code Code
5. Sort an array of 0’s Solution Click YouTube Code Code
1’s 2’s
6. Stock Buy and Sell Solution Click YouTube Code Code
D ay-2
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Rotate Matrix Solution Click Youtube Code Code
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
2 Merge Overlapping Solutio Clic YouTub Cod Cod
Subintervals
n k e e e
Merge two sorted Arrays
3. without Solutio Click YouTube Code Code
extra space n
Find the duplicate in an
Comin
4. array Click YouTube Code Code
g Soon
of N+1 integers.
5. Repeat and Missing Number Solutio Click YouTube Code Code
n
6. Inversion of Ar r a y (Pre-req: Solutio Click YouTube Code Code
Merge Sort)
n
D ay-3
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Search in a 2d Matrix Solution Click Youtube Code Code
2 Pow(X,n) Solution Click YouTube Code Code
3. Majority Element (>N/2 Solutio Clic YouTub Cod Cod
times)
n k e e e
4. Majority Element (>N/3 Solutio Clic YouTub Cod Cod
times)
n k e e e
5. Gr id Unique Paths Solutio Clic YouTub Cod Cod
n k e e e
6. Reverse Pairs Solutio Clic YouTub Cod Cod
(Leetcode)
n k e e e
D ay-4
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 2-Sum-Problem Solution Click Youtube Code Code
2 4-sum-Problem Solution Click YouTube Code Code
3. Longest Consecutive Comin Clic YouTub Cod Cod
Sequence g Soon
k e e e
4. Largest Subarray with 0 Solutio Clic YouTub Cod Cod
sum
n k e e e
Detailed Problem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
Count number of
5. subarrays with Solution Click YouTube Code Code
given Xor K
6. Longest Substring
Solution Click YouTube Code Code
without repeat
Day-5: Linked
List
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Reverse a LinkedList Solution Click Youtube Code Code
2 Find the middle of Solutio Clic YouTub Cod Cod
LinkedList
n k e e e
Merge two sorted Linked
3. List Solutio Clic YouTub Cod Cod
(use method used n k e e e
in mergeSort)
Remove N-th node from
4. back of Solution Click YouTube Code Code
LinkedList
5. Add two numbers as
Solution Click YouTube Code Code
LinkedList
Delete a given Node
6. when a node Comin Clic YouTub Cod Cod
is given. g Soon
k e e e
(0(1) solution)
D ay-6
Q.No Problem Name Problem Link Video Solution C++ Code Java Code
1 Find intersection point
Click Youtube Code Code
of Y LinkedList
2 Detect a cycle in Linked List Click YouTube Code Code
3. Reverse a LinkedList in Click YouTube Code Code
groups of size k.
4. Check if a LinkedList is
Click YouTube Code Code
palindrome or not.
Q.No Problem Name Problem Link Video Solution C++ Code Java Code
Find the starting point
5. Click YouTube Code Code
of the Loop of LinkedList
6. Flattening of a LinkedList Click YouTube Code Code
7. Rotate a LinkedList Click YouTube Code Code
D ay-7
Detailed Problem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Clone a Linked List with
Click Youtube Code Code
random and next pointer
2 3 sum Solution Click YouTube Code Code
3. Trapping rainwater Solution Click YouTube Code Code
4. Remove Duplicate from Solution Click YouTube Code Code
Sorted array
5. Max consecutive ones Solution Click YouTube Code Code
Day-8
Q.No Problem Name Detailed Pr oblem Video C++ Java
Solution Link Solution Code Code
1 N meeting in one room Click Youtube Code Code
Minimum number of
2 platforms Solution Click YouTube Code Code
required for a railway
3. Job sequencing Problem Click YouTube Code Code
4. Fractional Knapsack Click YouTube Code Code
Problem
5. Greedy algorithm to find
Click YouTube Code Code
minimum number of coins
Activity Selection
6. (it is the same as N meeting Click Youtube Code Code
in one room)
Day-9: Recursion
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Subset Sums Solution Click Youtube Code Code
2 Subset-II Click YouTube Code Code
3. Combination sum-1 Solution Click YouTube Code Code
4. Combination sum-2 Click YouTube Code Code
5. Palindrome
Solution Click YouTube Code Code
Par titioning
6. K-th permutation
Solution Click YouTube Code Code
Sequence
Day-10 : Recursion & Backtracking
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Print all permutations of a Clic Youtub Cod Cod
string/array
k e e e
2 N queens Problem Clic Youtub Cod Cod
k e e e
3. Sudoku Solver Clic Youtub Cod Cod
k e e e
4. M coloring Problem Clic Youtub Cod Cod
k e e e
5. Rat in a Maze Clic Youtub Cod Cod
k e e e
6. W or d Break (print all ways) Clic Youtub Cod Cod
k e e e
Day-11: Binary Search
Q.No Problem Name Detailed Problem Video C++ Java
Solution Link Solution Code Code
1 The N-th root of an integer Solution Click Youtube Code Code
2 Matrix Median Click Youtube Code Code
Find the element that appears
once in a sorted array, and the
3. Solution Click Youtube Code Code
rest element appears twice
(Binary search)
Search element in a sorted and
4. rotated array/ find pivot where it Solution Click Youtube Code Code
is rotated
Detailed Problem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
5. Median of 2 sorted arrays Solution Click Youtube Code Code
6. K-th element of two sorted Solution Click Youtube Code Code
arrays
7. Allocate Minimum Number of
Solution Click Youtube Code Code
Pages
8. Aggressive Cows Solution Click Youtube Code Code
Day-12: TRIES (Can be done at Last, but still a v e r y ver y important
topic) Watch this playlist -> Link
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Implement Trie (Prefix Tree) Click Youtube Code Code
2 Im plem ent Tr ie –2 (Pr efix Tr ee) Clic Youtub Cod Cod
k e e e
3. Longest String with All Prefixes Clic Youtub Cod Cod
k e e e
4. Number of Distinct Substrings in a Clic Youtub Cod Cod
String
k e e e
4. Power Set (this is very important) Clic Youtub Cod Cod
k e e e
5. Maximum XOR of two numbers in
Click Youtube Code Code
an array
6. Maximum XOR W it h an Element
Click Youtube Code Code
From Ar r a y
Day-13 : (Stack and Queue)
Q.No Problem Name Solution Pr oblem Video C++ Java
Link Solution Code Code
1 Implement Stack Using Arrays Solution Click Youtube Code Code
2 Implement Queue Using Arrays Solution Click Youtube Code Code
3. Implement Stack using Queue Solutio Clic Youtub Cod Cod
(using single queue)
n k e e e
4. Implement Queue using Stack Solutio Clic Youtub Cod Cod
(0(1) amortized method)
n k e e e
5. Check for balanced parentheses Solutio Clic Youtub Cod Cod
n k e e e
Q.No Problem Name Solution Pr oblem Video C++ Java
Link Solution Code Code
6. Next Greater Element Solution Click Youtube Code Code
7. Sort a Stack Click Youtube Code Code
Day-14 :
Q.No Problem Name Detailed Pr oblem Video C++ Java
Solution Link Solution Code Code
1 Next Smaller Element Click Youtube Code Code
2 LRU cache (IMPORTANT) Solution Click Youtube Code Code
3. LFU Cache Click Youtube Code Code
Two-Pass:
Youtub
Largest rectangle in a
4. Solutio Clic e Cod Cod
histogram
n k One e e
Pass:
Youtube
5. Sliding Window maximum Solutio Clic Youtub Cod Cod
n k e e e
6. Implement Min Stack Solutio Clic Youtub Cod Cod
n k e e e
7. Rotten Orange (Using BFS) Solutio Clic
n k
8. Stock Span Problem Clic
k
Find the maximum of
9. minimums of every window Clic
size k
10. The Celebrity Problem Clic
k
Day-15: String
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Reverse Words in a String Click Youtube Code Code
2 Longest Palindrome in a string Clic Youtub Cod Cod
k e e e
3. Roman Number to Integer and vice Clic Youtub Cod Cod
versa
k e e e
4. Implement ATOI/STRSTR Clic Youtub Cod Cod
k e e e
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
5. Longest Common Prefix Click Youtube Code Code
6. Rabin Karp Click Youtube Code Code
Day-16: String [Continued]
Pr oblem Video C++
Q.No Problem Name Java Code
Link Solution Code
1 Z-Function Click Youtube Code Code
2 KMP algo / LPS(pi) array Click YouTube Code Code
Minimum characters needed
to be inserted in the
3. Click YouTube Code Code
beginning
to make it palindromic
4. Check for Anagrams Click YouTube Code Code
5. Count and Say Click YouTube Code Code
6. Compare version numbers Click YouTube Code Code
Day-17: Binary Tree
(Introduction)
Q.No Pr oblem Detailed Solution Pr oblem Video C++ Code Java Code
Name Link Solution
Youtube
Code
(Recur sive Code (Recur sive
Morris ) Youtube
Inorder (Recur sive ) Code
1 Traversal Clic (Iterative)
Tr aver sal ) Code (Iterative)
Iterative/Recursiv k Youtube (Iterative) Code
e (Morris (Morris)
Traversal)
Morris YouTube
2 Preorder Clic Youtube Code Cod
Traversal
Tr aver sal Solutio (Morris (Mor r is)
k e
n Traver sal
)
3. Postor der Solutio Clic YouTub Cod Cod
Traversal
n k e e e
LeftView
4. Of Binary Solutio Clic YouTub Cod Cod
Tree n k e e e
Q.No Pr oblem Detailed Solution Pr oblem Video C++ Code Java Code
Name Link Solution
Bottom
View of
5. Solution Click YouTube Code Code
Binary
Tree
Top View
6. of Binary Solution Click YouTube Code Code
Tree
Preorder
inorder
postorder
7. Solution
in a
single
traversal
Vertical
8. order Solution
traversal
Day-18: Binary Tree
[Continued]
Detailed Problem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Level or der Tr aver sal / Level Solution Click Youtube Code Code
order traversal in spiral form
2 Height of a Binary Tree Solution Click YouTube Code Code
3. Diameter of Binary Tree Solution Click YouTube Code Code
4. Check if the Binary tree is Solution Click YouTube Code Code
height-balanced or not
5. LCA in Binary Tree Solution Click YouTube Code Code
6. Check if two trees are identical Solution Click YouTube Code Code
or not
7. Zig Zag Traversal of Binary Tree Solution
8. Boundary Traversal of Binary Solution
Tree
Day-19: Binary Tree
[Continued]
Q.No Problem Name Detailed Pr oblem Video C++ Java
Solution Link Solution Code Code
Detailed Problem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1 Maximum path sum Solution Click Youtube Code Code
2 Construct Binary Tree from Click YouTube Code Code
inorder and preorder
3. Construct Binary Tree from
Click YouTube Code Code
Inorder and Postorder
4. Symmetric Binary Tree Solution Click YouTube Code Code
5. Flatten Binary Tree to Click YouTube Code Code
LinkedList
6. Check if Binary Tree is the
Click YouTube Code Code
m i r r o r of itself or not
Day-20: Binary Search Tree
Q.No Problem Name Pr oblem Video C++ Java
Link Solution Code Code
1 Populate Next Right pointers of Tree Click Youtube Code Code
2 Search given Key in BST Click YouTube Code Code
3. Construct BST from given keys Click YouTube Code Code
4. Check is a BT is BST or not Click YouTube Code Code
5. Find LCA of two nodes in BST Click YouTube Code Code
6. Find the inorder predecessor/successor of Clic YouTub Cod Cod
a given Key in BST.
k e e e
Day-21: Binary Search Tree [Continued]
Detailed Problem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
1. Floor in a BST Click Youtube Code Code
2. Ceil in a BST Click Youtube Code Code
3. Find K-th smallest element Solution Click YouTube Code Code
in BST
4. Find K-th largest element in
Solution Click YouTube Code Code
BST
Detailed Pr oblem Video C++ Java
Q.No Problem Name
Solution Link Solution Code Code
5. Find a pair with a given Clic YouTub Cod Cod
sum in BST
k e e e
6. BST iterator Clic YouTub Cod Cod
k e e e
7. Size of the largest BST in a Clic YouTub Cod Cod
Binary Tree
k e e e
8. Serialize and deserialize Solutio Clic YouTub Cod Cod
Binary Tree
n k e e e
Day-22: Trees [Miscellaneous]
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Binary Tree to Double Linked List Click Youtube Code Code
2 Find median in a stream of running Clic YouTub Cod Cod
integers.
k e e e
3. K-th largest element in a stream. Clic YouTub Cod Cod
k e e e
4. Distinct numbers in Window. Clic YouTub Cod Cod
k e e e
5. K-th largest element in an unsorted Clic YouTub Cod Cod
array.
k e e e
6. Flood-fill Algorithm Clic YouTub Cod Cod
k e e e
D ay-23: G r aph s –Par t 1
Problem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Clone a graph (Not that easy as it Click Youtube Code Code
looks)
2 DFS Click YouTube Code Code
3. BFS Click YouTube Code Code
4. Detect A cycle in Undirected Graph Click YouTube Code Code
using BFS
5. Detect A cycle in Undirected Graph
Click YouTube Code Code
using DFS
6. Detect A cycle in a Directed Graph
Click YouTube Code Code
using DFS
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
7. Detect A cycle in a Directed Graph Clic YouTub Cod Cod
using BFS
k e e e
DFS:
YouTub
8. Topological Sort Clic e Cod Cod
k BFS: e e
Youtub
e
9. Number of islands (Do in Gr id and Clic YouTub Cod Cod
Graph both)
k e e e
10. Bipartite Check using BFS Clic YouTub Cod Cod
k e e e
11. Bipartite Check using DFS Clic YouTub Cod Cod
k e e e
D ay-24: G r aph s –Par t 2
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Strongly Connected Component(using Clic Youtub Cod Cod
KosaRaju’s algo)
k e e e
2 Dijkstra’s Algorithm Clic YouTub Cod Cod
k e e e
3. Bellman-Ford Algo Clic YouTub Cod Cod
k e e e
4. Floyd Warshall Algorithm Clic YouTub Cod Cod
k e e e
5. MST using Prim’s Algo Clic YouTub Cod Cod
k e e e
6. MST using Kruskal’s Algo Clic YouTub Cod Cod
k e e e
D ay-25: D yn am ic Pr ogr am m in g –Par t 1
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
1 Max Product Subarray Click Youtube Code Code
2 Longest Increasing Subsequence Click YouTube Code Code
3. Longest Common Subsequence Click YouTube Code Code
4. 0-1 Knapsack Click YouTube Code Code
5. Edit Distance Click YouTube Code Code
Pr oblem Video C++ Java
Q.No Problem Name
Link Solution Code Code
6. Maximum sum increasing Clic YouTub Cod Cod
subsequence
k e e e
7. Matrix Chain Multiplication Clic YouTub Cod Cod
k e e e
D ay-26: D yn am ic Pr ogr am m in g –Par t 2
Q.No Problem Name Pr oblem Video C++ Java
Link Solution Code Code
Maximum sum path in the matrix, (count
1 paths and similar type do, also backtrack Click Youtube Code Code
to find the maximum path)
2 Coin change Click YouTube Code Code
3. Subset Sum Click YouTube Code Code
4. Rod Cutting Click YouTube Code Code
5. Egg Dropping Click YouTube Code Code
6. W or d Break Click YouTube Code Code
7. Palindrome Partitioning (MCM Variation) Click Youtube Code Code
8. Maximum profit in Job scheduling Click Youtube Code Code
Day-27:
1. Revise OS notes that you would have made during your sem
2. If not made notes, spend 2 or 3 days and make notes from
Knowledge Gate.
Day-28:
1. Revise DBMS notes that you would have made during your
semesters.
2. If not made notes, spend 2 or 3 days and make notes from
Knowledge Gate.
Day-29:
1. Revise CN notes, that you would have made during your sem.
2. If not made notes, spend 2 or 3 days and make notes from
Knowledge Gate.
Day-30:
1. Make a note of how will your represent your projects, and prepare
all questions related to tech which you have used in your projects.
Prepare a note which you can say for 3-10 minutes w hen he asks you
that say something about the project.
Hurrah!! You are ready for your placement after a month of
hard work without a cheat day.
~Striver