Open In App

DSA Sheet by Love Babbar

Last Updated : 06 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Who is Love Babbar?

Love Babbar is a famous Youtuber, graduated from NSUT Delhi who has also worked as a Software Engineer at Amazon.

What is a DSA Sheet?

A sheet that covers almost every concept of Data Structures and Algorithms.

  
DSA Sheet

So, this DSA sheet by Love Babbar contains 450 coding questions which will help in:

  • Understanding each and every concept of DSA.
  • Clearing the DSA round for the Interviews, as these are the questions generally asked in the companies like Amazon, Microsoft, Google, etc.
  • Basic Knowledge of Data Structures and Algorithms.
  • Having good knowledge of at-least one programming knowledge like C++, Java, Python.
  • Know how to use STL as it will make data structures and few techniques easier to implement.

Below is the topic-wise distribution of 450 questions:

 

 

    This sheet can be completed within 2-3 months without any cheat day. So, Start solving this 450 DSA Cracker from today itself. Keep a track of all the problems mentioned below: Practice Love Babbar DSA Sheet

Arrays

Question Article Practice
Reverse an Array/String Link Link
Find the maximum and minimum element in an array Link Link
Find the “Kth” max and min element of an array Link Link
Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algo Link Link
Move all the negative elements to one side of the array Link Link
Find the Union and Intersection of the two sorted arrays. Link Link
Write a program to cyclically rotate an array by one. Link Link
Find Largest sum contiguous Subarray [V. IMP] Link Link
Minimize the maximum difference between heights [V.IMP] Link Link
Minimum no. of Jumps to reach end of an array Link Link
Find duplicate in an array of N+1 Integers Link Link
Merge 2 sorted arrays without using Extra space. Link Link
Kadane’s Algo [V.V.V.V.V IMP] Link Link
Merge Intervals Link Link
Next Permutation Link Link
Count Inversion Link Link
Best time to buy and Sell stock Link Link
Find all pairs on integer array whose sum is equal to given number Link Link
Find common elements In 3 sorted arrays Link Link
Rearrange the array in alternating positive and negative items with O(1) extra space Link Link
Find if there is any subarray with sum equal to 0 Link Link
Find factorial of a large number Link Link
Find maximum product subarray Link Link
Find longest consecutive subsequence Link Link
Given an array of size n and a number k, fin all elements that appear more than ” n/k ” times. Link Link
Maximum profit by buying and selling a share at most twice Link Link
Find whether an array is a subset of another array Link Link
Find the triplet that sum to a given value Link Link
Trapping Rain water problem Link Link
Chocolate Distribution problem Link Link
Smallest Subarray with sum greater than a given value Link Link
Three way partitioning of an array around a given value Link Link
Minimum swaps required bring elements less equal K together Link Link
Minimum no. of operations required to make an array palindrome Link Link
Median of 2 sorted arrays of equal size Link Link
Median of 2 sorted arrays of different size Link Link

Matrix

Question Article Practice
Spiral traversal on a Matrix Link LInk
Search an element in a Matrix Link Link
Find median in a row wise sorted matrix Link Link
Find row with maximum no. of 1’s Link Link
Print elements in sorted order using row-column wise sorted matrix Link Link
Maximum size rectangle Link Link
Find a specific pair in matrix Link NA
Rotate matrix by 90 degrees Link Link
Kth smallest element in a row-column wise sorted matrix Link Link
Common elements in all rows of a given matrix Link Link

Strings

Question Article Practice
Reverse a String Link Link
Check whether a String is Palindrome or not Link Link
Find Duplicate characters in a string Link NA
Why strings are immutable in Java? Link NA
Write a Code to check whether one string is a rotation of another Link Link
Write a Program to check whether a string is a valid shuffle of two strings or not Link NA
Count and Say problem Link Link
Write a program to find the longest Palindrome in a string.[ Longest palindromic Substring] Link Link
Find Longest Recurring Subsequence in String Link Link
Print all Subsequences of a string. Link NA
Print all the permutations of the given string Link Link
Split the Binary string into two substring with equal 0’s and 1’s Link NA
Word Wrap Problem [VERY IMP]. Link Link
EDIT Distance [Very Imp] Link Link
Find next greater number with same set of digits. [Very Very IMP] Link Link
Balanced Parenthesis problem.[Imp] Link Link
Word break Problem[ Very Imp] Link Link
Rabin Karp Algorithm Link Link
KMP Algorithm Link Link
Convert a Sentence into its equivalent mobile numeric keypad sequence. Link Link
Minimum number of bracket reversals needed to make an expression balanced. Link Link
Count All Palindromic Subsequence in a given String. Link Link
Count of number of given string in 2D character array Link Link
Search a Word in a 2D Grid of characters. Link Link
Boyer Moore Algorithm for Pattern Searching. Link Link
Converting Roman Numerals to Decimal Link Link
Longest Common Prefix Link Link
Number of flips to make binary string alternate Link Link
Find the first repeated word in string. Link Link
Minimum number of swaps for bracket balancing. Link Link
Find the longest common subsequence between two strings. Link Link
Program to generate all possible valid IP addresses from given  string. Link Link
Write a program to find the smallest window that contains all characters of string itself. Link Link
Rearrange characters in a string such that no two adjacent are same Link Link
Minimum characters to be added at front to make string palindrome Link Link
Given a sequence of words, print all anagrams together Link Link
Find the smallest window in a string containing all characters of another string Link Link
Recursively remove all adjacent duplicates Link Link
String matching where one string contains wildcard characters Link Link
Function to find Number of customers who could not get a computer Link NA
Transform One String to Another using Minimum Number of Given Operation Link Link
Check if two given strings are isomorphic to each other Link Link
Recursively print all sentences that can be formed from list of word lists Link NA

Searching and Sorting:

Question Article Practice
Find first and last positions of an element in a sorted array Link Link
Find a Fixed Point (Value equal to index) in a given array Link Link
Search in a rotated sorted array Link Link
Square root of an integer Link Link
Maximum and minimum of an array using minimum number of comparisons Link Link
Optimum location of point to minimize total distance Link Link
Find the repeating and the missing Link Link
Find majority element Link Link
Searching in an array where adjacent differ by at most k Link Link
Find a pair with a given difference Link Link
Find four elements that sum to a given value Link Link
Maximum sum such that no 2 elements are adjacent Link Link
Count triplet with sum smaller than a given value Link Link
Merge 2 sorted arrays Link Link
Product array Puzzle Link Link
Sort array according to count of set bits Link Link
Minimum no. of swaps required to sort the array Link Link
Bishu and Soldiers Link Link
Rasta and Kheshtak Link Link
Kth smallest number again Link Link
Find pivot element in a sorted array Link Link
K-th Element of Two Sorted Arrays Link Link
Aggressive cows Link Link
Book Allocation Problem Link Link
EKOSPOJ: Link Link
Job Scheduling Algo Link Link
Missing Number in AP Link Link
Smallest number with atleast n trailing zeroes in factorial Link Link
Painters Partition Problem: Link Link
ROTI-Prata SPOJ Link Link
DoubleHelix SPOJ Link Link
Subset Sums Link Link
Find the inversion count Link Link
Implement Merge-sort in-place Link Link
Partitioning and Sorting Arrays with Many Repeated Entries Link Link

LinkedList:

Question Article Practice
Write a Program to reverse the Linked List. (Both Iterative and recursive) Link Link
Reverse a Linked List in group of Given Size. [Very Imp] Link Link
Write a program to Detect loop in a linked list. Link Link
Write a program to Delete loop in a linked list. Link Link
Find the starting point of the loop. Link Link
Remove Duplicates in a sorted Linked List. Link Link
Remove Duplicates in a Un-sorted Linked List. Link Link
Write a Program to Move the last element to Front in a Linked List. Link Link
Add “1” to a number represented as a Linked List. Link Link
Add two numbers represented by linked lists. Link Link
Intersection of two Sorted Linked List. Link Link
Intersection Point of two Linked Lists. Link Link
Merge Sort For Linked lists.[Very Important] Link Link
Quicksort for Linked Lists.[Very Important] Link Link
Find the middle Element of a linked list. Link Link
Check if a linked list is a circular linked list. Link Link
Split a Circular linked list into two halves. Link Link
Write a Program to check whether the Singly Linked list is a palindrome or not. Link Link
Deletion from a Circular Linked List. Link Link
Reverse a Doubly Linked list. Link Link
Find pairs with a given sum in a DLL. Link Link
Count triplets in a sorted DLL whose sum is equal to given value “X”. Link Link
Sort a “k”sorted Doubly Linked list.[Very IMP] Link Link
Rotate Doubly Linked list by N nodes. Link Link
Rotate a Doubly Linked list in group of Given Size.[Very IMP] Link Link
Can we reverse a linked list in less than O(n) ? Link Link
Why Quicksort is preferred for. Arrays and Merge Sort for Linked Lists ? Link Link
Flatten a Linked List Link Link
Sort a LL of 0’s, 1’s and 2’s Link Link
Clone a linked list with next and random pointer Link Link
Merge K sorted Linked list Link Link
Multiply 2 no. represented by LL Link Link
Delete nodes which have a greater value on right side Link Link
Segregate even and odd nodes in a Linked List Link Link
Program for n’th node from the end of a Linked List Link Link

Bit Manipulation:

Question Article Practice
Count set bits in an integer Link Link
Find the two non-repeating elements in an array of repeating elements Link Link
Count number of bits to be flipped to convert A to B Link Link
Count total set bits in all numbers from 1 to n Link Link
Program to find whether a no is power of two Link Link
Find position of the only set bit Link Link
Copy set bits in a range Link Link
Divide two integers without using multiplication, division and mod operator Link Link
Calculate square of a number without using *, / and pow() Link Link
Power Set Link Link

Greedy

Question Article Practice
Activity Selection Problem Link Link
Job Sequencing Problem Link Link
Huffman Coding Link Link
Water Connection Problem Link Link
Fractional Knapsack Problem Link Link
Greedy Algorithm to find Minimum number of Coins Link Link
Maximum trains for which stoppage can be provided Link Link
Minimum Platforms Problem Link Link
Buy Maximum Stocks if i stocks can be bought on i-th day Link Link
Find the minimum and maximum amount to buy all N candies Link Link
Minimize Cash Flow among a given set of friends who have borrowed money from each other Link Link
Minimum Cost to cut a board into squares Link Link
Check if it is possible to survive on Island Link Link
Find maximum meetings in one room Link Link
Maximum product subset of an array Link Link
Maximize array sum after K negations Link Link
Maximize the sum of arr[i]*i Link Link
Maximum sum of absolute difference of an array Link Link
Maximize sum of consecutive differences in a circular array Link Link
Minimum sum of absolute difference of pairs of two arrays Link Link
Program for Shortest Job First (or SJF) CPU Scheduling Link Link
Program for Least Recently Used (LRU) Page Replacement algorithm Link Link
Smallest subset with sum greater than all other elements Link Link
Chocolate Distribution Problem Link Link
DEFKIN -Defense of a Kingdom Link Link
DIEHARD -DIE HARD Link Link
GERGOVIA -Wine trading in Gergovia Link Link
Picking Up Chicks Link Link
CHOCOLA –Chocolate Link Link
ARRANGE -Arranging Amplifiers Link Link
K Centers Problem Link Link
Minimum Cost of ropes Link Link
Find smallest number with given number of digits and sum of digits Link Link
Rearrange characters in a string such that no two adjacent are same Link Link
Find maximum sum possible equal sum of three stacks Link Link

Backtracking

Question Article Practice
Rat in a maze Problem Link Link
Printing all solutions in N-Queen  Link Link
Word Break Problem using Backtracking Link Link
Remove Invalid Parentheses Link Link
Sudoku Solver Link Link
M Coloring Problem Link Link
Print all palindromic partitions of a string Link Link
Subset Sum Problem Link Link
The Knight’s tour problem Link Link
Tug of War Link Link
Find shortest safe route in a path with landmines Link Link
Combinational Sum Link Link
Find Maximum number possible by doing at-most K swaps Link Link
Print all permutations of a string Link Link
Find if there is a path of more than k length from a source Link Link
Longest Possible Route in a Matrix with Hurdles Link Link
Print all possible paths from top left to bottom right of a mXn matrix Link Link
Partition of a set into K subsets with equal sum Link Link
Find the K-th Permutation Sequence of first N natural numbers Link Link

Dynamic Programming

Question Article Practice
Coin Change Problem Link Link
Knapsack Problem Link Link
Binomial Coefficient Problem Link Link
Permutation Coefficient Problem Link Link
Program for nth Catalan Number Link Link
Matrix Chain Multiplication Link Link
Edit Distance Link Link
Subset Sum Problem Link Link
Friends Pairing Problem Link Link
Gold Mine Problem Link Link
Assembly Line Scheduling Problem Link Link
Painting the Fence problem Link Link
Maximize The Cut Segments Link Link
Longest Common Subsequence Link Link
Longest Repeated Subsequence Link Link
Longest Increasing Subsequence Link Link
Space Optimized Solution of LCS Link Link
LCS (Longest Common Subsequence) of three strings Link Link
Maximum Sum Increasing Subsequence Link Link
Count all subsequences having product less than K Link Link
Longest subsequence such that difference between adjacent is one Link Link
Maximum subsequence sum such that no three are consecutive Link Link
Egg Dropping Problem Link Link
Maximum Length Chain of Pairs Link Link
Maximum size square sub-matrix with all 1s Link Link
Maximum sum of pairs with specific difference Link Link
Min Cost Path Problem Link Link
Maximum difference of zeros and ones in binary string Link Link
Minimum number of jumps to reach end Link Link
Minimum cost to fill given weight in a bag Link Link
Minimum removals from array to make max –min <= K Link Link
Longest Common Substring Link Link
Count number of ways to reach a given score in a game Link Link
Count Balanced Binary Trees of Height h Link Link
LargestSum Contiguous Subarray [V>V>V>V IMP ] Link Link
Smallest sum contiguous subarray Link Link
Unbounded Knapsack (Repetition of items allowed) Link Link
Word Break Problem Link Link
Largest Independent Set Problem Link Link
Partition problem Link Link
Longest Palindromic Subsequence Link Link
Count All Palindromic Subsequence in a given String Link Link
Longest Palindromic Substring Link Link
Longest alternating subsequence Link Link
Weighted Job Scheduling Link Link
Coin game winner where every player has three choices Link Link
Count Derangements (Permutation such that no element appears in its original position) [ IMPORTANT ] Link Link
Maximum profit by buying and selling a share at most twice [ IMP ] Link Link
Optimal Strategy for a Game Link Link
Optimal Binary Search Tree Link Link
Palindrome Partitioning Problem Link Link
Word Wrap Problem Link Link
Mobile Numeric Keypad Problem [ IMP ] Link Link
Boolean Parenthesization Problem Link Link
Largest rectangular sub-matrix whose sum is 0 Link Link
Largest area rectangular sub-matrix with equal number of 1’s and 0’s [ IMP ] Link Link
Maximum sum rectangle in a 2D matrix Link Link
Maximum profit by buying and selling a share at most k times Link Link
Find if a string is interleaved of two other strings Link Link
Maximum Length of Pair Chain Link Link

Stacks and Queues

Question Article Practice
Implement Stack from Scratch Link Link
Implement Queue from Scratch Link Link
Implement 2 stack in an array Link Link
Find the middle element of a stack Link Link
Implement “N” stacks in an Array Link Link
Check the expression has valid or Balanced parenthesis or not. Link Link
Reverse a String using Stack Link Link
Design a Stack that supports getMin() in O(1) time and O(1) extra space. Link Link
Find the next Greater element Link Link
The celebrity Problem Link Link
Arithmetic Expression evaluation Link Link
Evaluation of Postfix expression Link Link
Implement a method to insert an element at its bottom without using any other data structure. Link Link
Reverse a stack using recursion Link Link
Sort a Stack using recursion Link Link
Merge Overlapping Intervals Link Link
Largest rectangular Area in Histogram Link Link
Length of the Longest Valid Substring Link Link
Expression contains redundant bracket or not Link Link
Implement Stack using Queue Link Link
Implement Stack using Deque Link Link
Stack Permutations (Check if an array is stack permutation of other) Link Link
Implement Queue using Stack Link Link
Implement “n” queue in an array Link Link
Implement a Circular queue Link Link
LRU Cache Implementation Link Link
Reverse a Queue using recursion Link Link
Reverse the first “K” elements of a queue Link Link
Interleave the first half of the queue with second half Link Link
Find the first circular tour that visits all Petrol Pumps Link Link
Minimum time required to rot all oranges Link Link
Distance of nearest cell having 1 in a binary matrix Link Link
First negative integer in every window of size “k” Link Link
Check if all levels of two trees are anagrams or not. Link Link
Sum of minimum and maximum elements of all subarrays of size “k”. Link Link
Minimum sum of squares of character counts in a given string after removing “k” characters. Link Link
Queue based approach or first non-repeating character in a stream. Link Link
Next Smaller Element Link Link

Binary Trees

Question Article Practice
Level order traversal Link Link
Reverse Level Order traversal Link Link
Height of a tree Link Link
Diameter of a tree Link Link
Mirror of a tree Link Link
Inorder Traversal of a tree both using recursion and Iteration Link Link
Preorder Traversal of a tree both using recursion and Iteration Link Link
Postorder Traversal of a tree both using recursion and Iteration Link Link
Left View of a tree Link Link
Right View of Tree Link Link
Top View of a tree Link Link
Bottom View of a tree Link Link
Zig-Zag traversal of a binary tree Link Link
Check if a tree is balanced or not Link Link
Diagonal Traversal of a Binary tree Link Link
Boundary traversal of a Binary tree Link Link
Construct Binary Tree from String with Bracket Representation Link Link
Convert Binary tree into Doubly Linked List Link Link
Convert Binary tree into Sum tree Link Link
Construct Binary tree from Inorder and preorder traversal Link Link
Find minimum swaps required to convert a Binary tree into BST Link Link
Check if Binary tree is Sum tree or not Link Link
Check if all leaf nodes are at same level or not Link Link
Check if a Binary Tree contains duplicate subtrees of size 2 or more [ IMP ] Link Link
Check if 2 trees are mirror or not Link Link
Sum of Nodes on the Longest path from root to leaf node Link Link
Check if given graph is tree or not.  [ IMP ] Link Link
Find Largest subtree sum in a tree Link Link
Maximum Sum of nodes in Binary tree such that no two are adjacent Link Link
Print all “K” Sum paths in a Binary tree Link Link
Find LCA in a Binary tree Link Link
Find distance between 2 nodes in a Binary tree Link Link
Kth Ancestor of node in a Binary tree Link Link
Find all Duplicate subtrees in a Binary tree [ IMP ] Link Link
Tree Isomorphism Problem Link Link

Binary Search Tree:

Question Article Practice
Find a value in a BST Link Link
Deletion of a node in a BST Link Link
Find min and max value in a BST Link Link
Find inorder successor and inorder predecessor in a BST Link Link
Check if a tree is a BST or not Link Link
Populate Inorder successor of all nodes Link Link
Find LCA  of 2 nodes in a BST Link Link
Construct BST from preorder traversal Link Link
Convert Binary tree into BST Link Link
Convert a normal BST into a Balanced BST Link Link
Merge two BST [ V.V.V>IMP ] Link Link
Find Kth largest element in a BST Link Link
Find Kth smallest element in a BST Link Link
Count pairs from 2 BST whose sum is equal to given value “X” Link Link
Find the median of BST in O(n) time and O(1) space Link Link
Count BST nodes that lie in a given range Link Link
Replace every element with the least greater element on its right Link Link
Given “n” appointments, find the conflicting appointments Link Link
Check preorder is valid or not Link Link
Check whether BST contains Dead end Link Link
Largest BST in a Binary Tree [ V.V.V.V.V IMP ] Link Link
Flatten BST to sorted list Link Link

Graphs

Question Article Practice
Create a Graph, print it Link Link
Implement BFS algorithm Link Link
Implement DFS Algo Link Link
Detect Cycle in Directed Graph using BFS/DFS Algo Link Link
Detect Cycle in UnDirected Graph using BFS/DFS Algo Link Link
Search in a Maze Link Link
Minimum Step by Knight Link Link
Flood fill algo Link Link
Clone a graph Link Link
Making wired Connections Link Link
Word Ladder Link Link
Dijkstra algo Link Link
Implement Topological Sort Link Link
Minimum time taken by each job to be completed given by a Directed Acyclic Graph Link Link
Find whether it is possible to finish all tasks or not from given dependencies Link Link
Find the no. of Islands Link Link
Given a sorted Dictionary of an Alien Language, find order of characters Link Link
Implement Kruksal’sAlgorithm Link Link
Implement Prim’s Algorithm Link Link
Total no. of Spanning tree in a graph Link Link
Implement Bellman Ford Algorithm Link Link
Implement Floyd warshall Algorithm Link Link
Travelling Salesman Problem Link Link
Graph Colouring Problem Link Link
Snake and Ladders Problem Link Link
Find bridge in a graph Link Link
Count Strongly connected Components(Kosaraju Algo) Link Link
Check whether a graph is Bipartite or Not Link Link
Detect Negative cycle in a graph Link Link
Longest path in a Directed Acyclic Graph Link Link
Journey to the Moon Link Link
Cheapest Flights Within K Stops Link Link
Oliver and the Game Link Link
Water Jug problem using BFS Link Link
Find if there is a path of more thank length from a source Link Link
M-Colouring Problem Link Link
Minimum edges to reverse to make path from source to destination Link Link
Paths to travel each nodes using each edge(Seven Bridges) Link Link
Vertex Cover Problem Link Link
Chinese Postman or Route Inspection Link Link
Number of Triangles in a Directed and Undirected Graph Link Link
Minimise the cashflow among a given set of friends who have borrowed money from each other Link Link
Two Clique Problem Link Link

Heap

Question Article Practice
Implement a Maxheap/MinHeap using arrays and recursion. Link Link
Sort an Array using heap. (HeapSort) Link Link
Maximum of all subarrays of size k. Link Link
“K” largest element in an array Link Link
Kth smallest and largest element in an unsorted array Link Link
Merge “K” sorted arrays. [ IMP ] Link Link
Merge 2 Binary Max Heaps Link Link
Kth largest sum continuous subarrays Link Link
Leetcode- reorganize strings Link Link
Merge “K” Sorted Linked Lists [V.IMP] Link Link
Smallest range in “K” Lists Link Link
Median in a stream of Integers Link Link
Check if a Binary Tree is Heap Link Link
Connect “n” ropes with minimum cost Link Link
Convert BST to Min Heap Link Link
Convert min heap to max heap Link Link
Rearrange characters in a string such that no two adjacent are same. Link Link
Minimum sum of two numbers formed from digits of an array Link Link

Trie

Question Article Practice
Construct a trie from scratch Link Link
Find shortest unique prefix for every word in a given list Link Link
Word Break Problem | (Trie solution) Link Link
Given a sequence of words, print all anagrams together Link Link
Implement a Phone Directory Link Link
Print unique rows in a given boolean matrix Link Link


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads