logo
Topics
REPO/Love Babbar Sheet
Array36
Reverse array
Max min array
Kth max min
Sort arr 0 1 2
Negative ele to one side of array
Union and intersection
Cyclically rotate by 1
Largest sum conti arr
Minimize the height
Min jumps to reach end
Find duplicates
Merge 2 sorted array
Kadane's algo
Merge intervals
Next permutation
Count inversion
Best time to buy stock
All pair whose sum is k
Common ele in 3 sorted arr
Rearrange pos neg in alter
Subarray with sum 0
Factorial of large no
Maximum subarray product
Longest consequecutive subsequence
Find ele more than nBYk
Sell buy stock atmost twice
Array subset of another array
Triplet of ele sum
Trap rain water problem
Choclate distribution problem
Smallest subarray with sum greater than k
Three way partitioning array
Min swaps require to grp together
Check if palindrom or not
Median of 2 sorted array equal size
Median of 2 sorted array diff size
Matrix10
Spiral traversal on matrix
Search an ele in matrix
Median in row wise sorted matrix
Row with maximum 1
Print in sorted row col sorted matrix
Max size rectangle
Specific pair in matrix
Rotate matrix by 90
Kth smallest in row col sorted matrix
Common ele in all rows
String43
01-reverse-string
02-is-palindrom
Duplicates char in string
Why string are immutable
Check rotation of other
String shuffle of other
Count and say
Longest palindromic substring
Longest recurring subsequence
Print all subsequence of string
Print all permutation of string
Split binary string with equal 1 and 0
Word wrap
Edit distance
Find next greater no with same set of digit
Balanced paranthesis
Word break
Rabin karp
KMP
Convert sentence into numeric keypad sequence
Min no of bracket reversals
Count all palindromic subsequence
Count of no of given string
Search word in 2d grid
Boyer moore for pattern searching
Converting roman numerals to integer
Longest common prefix
Min no of flip to alternate
First repeated word in string
Min no of swaps for bracket balancing
Longest common subsequence
Program to generate all valid IP
Smallest window contains all char of string itself
Rearrange chars such that two adjacent are not same
Minimum char added at front to make palindrom
Given sequence of all words print all anagrams
Smallest window in string cont all char of another string
Recursively remove all adjacent same char
String match where one string have wild char
No of customers who could not find computer
Transform one string to another
Check if two given string are isomorphic of each other
Recur print all the sentence from list of words
Searching and sorting36
First pos and last pos
Find fixed point
Search in rotated array
Square root of an integer
Max min with min comparison
Optimum location of point to minimize distance
Find rep and missing
Find majority ele
Searching array with adj diff by almost k
Find pair with given diff
Find four ele that sum to given value
Max sum such that no 2 ele are adjacent
Count triplet with sum less than given value
Merge 2 sorted array
Subarray with sum 0
Product array puzzle
Sort array acc to count of set bits
Min swaps require to sort array
Bishu and soldier
Rasta and kashtak
Kth smallest no again
Pivot ele in sorted array
Kth ele of 2 sorted array
Aggressive cows
Book allocation problem
EKO
Job scheduling algo
Missing no in AP
Smallest no with n trailing zero
Painters partition problem
Roti prata
Double helix
Sub set sum
Find inverse count
Implement merge sort in place
Partitioning and sorting array with repeating entries
Linked list36
Reverse linklist
Reverse linklist given n
Detect loop
Delete loop
First node in loop
Remove duplicates in sorted linklist
Remove duplicates from unsorted linklist
Move last ele to front
Add 1 to no in linklist
Add 2 no represented by linklist
Intersection of 2 linklist
Intersection point of 2 linklist
Merge sort for linklist
Quick sort for linklist
Middle ele of linklist
Check if circular linklist
Split circular linklist into 2 halves
Singly linklist is palindrom or not
Deletion from circular linklist
Reverse doubly linklist
Find pair with given sum in sorted DLL
Count triplets in sorted DLL whose sum is x
Sort k sorted DLL
Rotate doubly linklist by n node
Reverse or rotate doubly linklist in given size
Reverse link list in big logn
Quicksort for array merge sort for linklist
Flattern a linklist
Sort LL of 0 1 and 2
Clone linklist with next and random pointer
Merge k sorted LL
Multiply 2 no from linklist
Delete nodes which have greater value on right side
Segregate even and odd nodes in linklist
Nth node from the end of the linklist
First non repeating char string stream
Binary trees35
Level order traversal
Reverse level order traversal
Height of tree
Diameter of tree
Mirror of tree
Inorder traversal recursion itertion
Preorder traversal recursion itertion
Postorder traversal recursion itertion
Left view of tree
Right view of tree
Top view of tree
Bottom view of tree
Zigzag traversal of binary tree
Check if tree is balance or not
Diagonal traversal of binary tree
Boundary traversal of binary tree
Construct binary tree from string using bracket presentation
Convert binary trees into doubly linklist
Convert binary trees into sum trees
Construct binary trees from inorder preorder traversal
Minimum swaps require to convert binary tree to BST
Check if binary tree is sum tree or not
Check if all leaf node are at same level
Check if BT contains duplicate subtree of size 2
Check if two trees are mirror or not
Sum of nodes on longest path from root to leaf nodes
Check if graph is tree or not
Largest subtree sum in tree
Maximum sum of nodes in BT such that no 2 are adjacent
Print all K sum path in BT
Find LCA in BT
Distance between 2 nodes in binary trees
Kth ancestor of node in BT
Find all duplicate subtree in BT
Trees isomorphism problem
Binary search trees22
Find a value in BST
Deletion of node in BST
Min max value in BST
Find inorder successor predecessor in BST
Check if tree is BST or not
Populate inorder successor of BST
Find LCA of 2 nodes in BST
Construct BST from preorder traversal
Convert binary tree into BST
Convert normal BST to balanced BST
Merge 2 BST
Kth largest ele in BST
Kth smallest ele in BST
Count pairs from 2 BST whose sum is equal to given X
Find median in BST in ON TC and O1 SC
Count BST nodes which lies in given range
Replace every element with least greater ele on its right
Given N appointments find conflicting appointments
Check if preorder is valid or not
Check wether BST contains dead end
Largest BST in binary tree
Flatten BST to sorted list
Greedy35
Activity selection problem
Job sequencing problem
Huffman coding
Water connection problem
Fractional knapsack problem
Find minimum no of coins
Maximum trains for which stoppage can be provided
Minimum platform problem
Buy maximum stock if can be bought on ith day
Max min amount to buy all candy
Min cash flow in friends who has borrowed money
Min cost to cut board into square
Check if its possible to survive on island
Find maximum meetings in one room
Maximum product subset of an array
Maximize array sum after k negations
Maximize sum of arr i into i
Maximum sum of absolute difference of an array
Maximum sum of consecutive difference in circular array
Min sum of absolute difference in pair of 2 arrays
Shortest job first SJF
Least recently used LRU page replacement
Smallest subset with sum greater than all other element
Chocolate distribution problem
DEFKIN defence of kingdom
Die hard
GERGOVIA wine trading in gergovia
Picking up chicks
CHOCOLA choclate
ARRANGE arranging amplifiers
K centers problem
Minimum cost of ropes
Find smallest no given total no of digits and sum of digits
Rearrange characters in string such that no 2 adjacent are same
Find maximum sum possible equal sum of three stacks
Backtracking20
Intro
Rat in maze
Print all solution in N queen problem
Word break problem using backtracking
Remove invalid paranthesis
Sudoku solver
M coloring problem
Print all palindromic partitions of string
Subset sum problem
Knights tour problem
Tug of war
Find shortest safe route in path with landmines
Combinational sum
Maximum no possible by doing atmost k swaps
Print all permutations of string
Find if there is path of more than k length from source
Longest possible route in matrix with hurdles
Print all possible path from top left to bottom right in MN matrix
Partition of set into K subset with equal sum
Kth permutation sequence of first N natural no
Stack and queues38
Implement stack from scratch
Implement queue from scratch
Implement 2 stack in array
Find middle ele in stack
Implement N stacks in one array
Check expression has balanced paranthesis or not
Reverse string using stack
MinEle in O1 TC O1 SC
Find next greater ele
The celebrity problem
Arithmetic expression evaluation
Evaluation of postfix expression
Insert ele in bottom without using datastructure
Reverse stack using recursion
Sort stack using recursion
Merge overlapping intervals
Largest rectangular area in histogram
Length of the longest valid string
Expression contains redundant brackets or not
Implement stack using queue
Implement stack and queue using dequeue
Stack permutations
Implement queue using stack
Implement n queue using array
Implement circular queue
LRU cache implementation
Reverse queue using recursion
Reverse first K element of queue
Interleave first half of queue with second half
First circular tour visiting all petrol pumps
Minimum time required to rot all oranges
Distance of nearest cell having 1
First negative in every window of size k
Check if all levels of trees is anagram
Sum of minimum and maximum elements of all subarrays of size k
Minimum sum of squares of character counts in given string after removing k characters
Queue based approach or first non repeating character in stream
Next smaller element
Heap18
Maxheap minheap using array and recursion
Sort array using heap HEAPSORT
Maximum of all subarray of size K
K largest ele in array
Kth smallest and kth largest in unsorted array
Merge k sorted array
Merge two binary maxheaps
Kth largest sum continuous subarrays
Reorganize strings
Merge K sorted linklist
Smallest range in k list
Median in stream of integers
Check if binary trees is heap or not
Connect N ropes with minimum cost
Convert BST to minHeap
Convert minHeap to maxHeap
Rearrange characters in strings such that no 2 adjacent are same
Min sum of 2 no formed from digits of an array
Graph48
Graph
Create and print graph
Implement BFS algorithm
Implement DFS algorithm
Detect cycle in directed graph using DFS BFS
Detect cycle in undirected graph using DFS BFS
Search in maze
Minimum step by knight
Flood fill algo
Clone a graph
Making wired connections
Word ladder
Dijkstra algo
Implement topological sort
Minimum time taken by each job to be completed given by a Directed Acyclic Graph
Find whether it is possible to finish all tasks or not from given dependencies
Find no of islands
Given sorted alien dictionary find the order of character
Implement kruskals algorithm
Implement prims algorithm
Total no of spanning tree in graph
Implement bellman ford algorithm
Implement floyd warshalls algorithm
Travelling salesman problem
Graph coloring problem
Snake and ladders problem
Find bridge in graph (cut edge)
Kosaraju algo count strongly connected components
Check if graph is bipartite or not
Detect negative cycle in graph
Longest path in directed acyclic graph
Journey to the moon
Cheapest flights within K stops
Oliver and the game
WaterJug problem using BFS
Find if there is a path of more than k length from a source
M coloring problem
Minimum edges to reverse to make path from a source to a destination
Paths to travel each node using each edge seven bridge
Vertex cover problem
Chinese postman or route inspection
No of triangle in directed or undirected graphs
Minimize Cash Flow among a given set of friends who have borrowed money from each other
Two clique problem
Extra 01 shortest path in undirected graph with unit weight
Extra 02 shortest path in DAG with weight
Extra 03 disjoint set union by rank and path compression
Extra 04 articulation point (cut vertex)
Trie13
Construct trie from scratch
Find shortest unique prefix for every word in a given list
Word break problem
Given sequence of words print all anagrams together
Implement phone directory
Print unique rows in given boolean matrix
Extra 01 count prefix of string
Extra 02 autocomplete
Extra 03 add and search
Extra 04 longest duplicate sub string
Extra 05 suffix trie
Extra 06 cute cat
Extra 07 biggest xor
Bit-manipulation10
Count set bits in num
Non repeating elements
Bits flipped
Total set bits from 1 to n
No is power of 2
Find pos of set bit
Copy set bit in range
Without div mul mod
Square of no without mul pow divide
Power set
Reverse array