Arrays
Question Article Practice
Reverse the array Link Link
Find the maximum and Link Link
minimum element in an array
Find the “Kth” max and min Link Link
element of an array
Given an array which consists
of only 0, 1 and 2. Sort the Link Link
array without using any sorting
algo
Move all the negative elements Link Link
to one side of the array
Find the Union and
Intersection of the two sorted Link Link
arrays.
Write a program to cyclically Link Link
rotate an array by one.
Find Largest sum contiguous Link Link
Subarray [V. IMP]
Minimize the maximum
difference between heights Link Link
[V.IMP]
Minimum no. of Jumps to Link Link
reach end of an array
Find duplicate in an array of Link Link
N+1 Integers
Merge 2 sorted arrays without Link Link
using Extra space.
Kadane’s Algo [V.V.V.V.V Link Link
IMP]
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 Link Link
number
Find common elements In 3 Link Link
sorted arrays
Rearrange the array in
alternating positive and Link Link
negative items with O(1) extra
space
Find if there is any subarray Link Link
with sum equal to 0
Find factorial of a large Link Link
number
Find maximum product Link Link
subarray
Find longest consecutive Link Link
subsequence
Given an array of size n and a
number k, fin all elements that Link Link
appear more than ” n/k ” times.
Maximum profit by buying
and selling a share at most Link Link
twice
Find whether an array is a Link Link
subset of another array
Find the triplet that sum to a Link Link
given value
Trapping Rain water problem Link Link
Chocolate Distribution Link Link
problem
Smallest Subarray with sum Link Link
greater than a given value
Three way partitioning of an Link Link
array around a given value
Minimum swaps required
bring elements less equal K Link Link
together
Minimum no. of operations
required to make an array Link Link
palindrome
Median of 2 sorted arrays of Link Link
equal size
Median of 2 sorted arrays of Link Link
different size
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 Link Link
sorted matrix
Find row with maximum no. Link Link
of 1’s
Print elements in sorted order
using row-column wise sorted Link Link
matrix
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- Link Link
column wise sorted matrix
Common elements in all rows Link Link
of a given matrix
Strings
Question Article Practice
Reverse a String Link Link
Check whether a String is Link Link
Palindrome or not
Find Duplicate characters in a Link
NA
string
Why strings are immutable in Link
NA
Java?
Write a Code to check whether
one string is a rotation of Link Link
another
Write a Program to check
whether a string is a valid Link NA
shuffle of two strings or not
Count and Say problem Link Link
Write a program to find the
longest Palindrome in a string. Link Link
[ Longest palindromic
Substring]
Find Longest Recurring Link Link
Subsequence in String
Print all Subsequences of a Link NA
string.
Print all the permutations of Link Link
the given string
Split the Binary string into two
substring with equal 0’s and Link NA
1’s
Word Wrap Problem [VERY Link Link
IMP].
EDIT Distance [Very Imp] Link Link
Find next greater number with
same set of digits. [Very Very Link Link
IMP]
Balanced Parenthesis problem. Link Link
[Imp]
Word break Problem[ Very Link Link
Imp]
Rabin Karp Algorithm Link Link
KMP Algorithm Link Link
Convert a Sentence into its
equivalent mobile numeric Link Link
keypad sequence.
Minimum number of bracket
reversals needed to make an Link Link
expression balanced.
Count All Palindromic Link Link
Subsequence in a given String.
Count of number of given Link Link
string in 2D character array
Search a Word in a 2D Grid of Link Link
characters.
Boyer Moore Algorithm for Link Link
Pattern Searching.
Converting Roman Numerals Link Link
to Decimal
Longest Common Prefix Link Link
Number of flips to make Link Link
binary string alternate
Find the first repeated word in Link Link
string.
Minimum number of swaps for Link Link
bracket balancing.
Find the longest common
subsequence between two Link Link
strings.
Program to generate all
possible valid IP addresses Link Link
from given string.
Write a program to find the
smallest window that contains Link Link
all characters of string itself.
Rearrange characters in a
string such that no two Link Link
adjacent are same
Minimum characters to be
added at front to make string Link Link
palindrome
Given a sequence of words, Link Link
print all anagrams together
Find the smallest window in a
string containing all characters Link Link
of another string
Recursively remove all Link Link
adjacent duplicates
String matching where one
string contains wildcard Link Link
characters
Function to find Number of
customers who could not get a Link NA
computer
Transform One String to
Another using Minimum Link Link
Number of Given Operation
Check if two given strings are Link Link
isomorphic to each other
Recursively print all sentences
that can be formed from list of Link NA
word lists
Searching and Sorting:
Question Article Practice
Find first and last positions of Link Link
an element in a sorted array
Find a Fixed Point (Value Link Link
equal to index) in a given array
Search in a rotated sorted array Link Link
Square root of an integer Link Link
Maximum and minimum of an
array using minimum number Link Link
of comparisons
Optimum location of point to Link
Link
minimize total distance
Find the repeating and the Link Link
missing
Find majority element Link Link
Searching in an array where Link Link
adjacent differ by at most k
Find a pair with a given Link Link
difference
Find four elements that sum to Link Link
a given value
Maximum sum such that no 2 Link Link
elements are adjacent
Count triplet with sum smaller Link Link
than a given value
Merge 2 sorted arrays Link Link
Product array Puzzle Link Link
Sort array according to count Link Link
of set bits
Minimum no. of swaps Link Link
required to sort the array
Bishu and Soldiers Link Link
Rasta and Kheshtak Link Link
Kth smallest number again Link Link
Find pivot element in a sorted Link Link
array
K-th Element of Two Sorted Link Link
Arrays
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 Link Link
trailing zeroes in factorial
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 Link Link
Entries
LinkedList:
Question Article Practice
Write a Program to reverse the
Linked List. (Both Iterative Link Link
and recursive)
Reverse a Linked List in group Link Link
of Given Size. [Very Imp]
Write a program to Detect loop Link Link
in a linked list.
Write a program to Delete loop Link Link
in a linked list.
Find the starting point of the Link
Link
loop.
Remove Duplicates in a sorted Link Link
Linked List.
Remove Duplicates in a Un- Link Link
sorted Linked List.
Write a Program to Move the
last element to Front in a Link Link
Linked List.
Add “1” to a number Link Link
represented as a Linked List.
Add two numbers represented Link Link
by linked lists.
Intersection of two Sorted Link Link
Linked List.
Intersection Point of two Link Link
Linked Lists.
Merge Sort For Linked lists. Link Link
[Very Important]
Quicksort for Linked Lists. Link Link
[Very Important]
Find the middle Element of a Link Link
linked list.
Check if a linked list is a Link Link
circular linked list.
Split a Circular linked list into Link Link
two halves.
Write a Program to check
whether the Singly Linked list Link Link
is a palindrome or not.
Deletion from a Circular Link Link
Linked List.
Reverse a Doubly Linked list. Link Link
Find pairs with a given sum in Link
Link
a DLL.
Count triplets in a sorted DLL
whose sum is equal to given Link Link
value “X”.
Sort a “k”sorted Doubly Link Link
Linked list.[Very IMP]
Rotate Doubly Linked list by Link Link
N nodes.
Rotate a Doubly Linked list in
group of Given Size.[Very Link Link
IMP]
Can we reverse a linked list in
Link Link
less than O(n) ?
Why Quicksort is preferred
for. Arrays and Merge Sort for Link Link
Linked Lists ?
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 Link Link
and random pointer
Merge K sorted Linked list Link Link
Multiply 2 no. represented by Link Link
LL
Delete nodes which have a Link Link
greater value on right side
Segregate even and odd nodes Link Link
in a Linked List
Program for n’th node from Link Link
the end of a Linked List
Bit Manipulation:
Question Article Practice
Count set bits in an integer Link Link
Find the two non-repeating
elements in an array of Link Link
repeating elements
Count number of bits to be Link Link
flipped to convert A to B
Count total set bits in all Link Link
numbers from 1 to n
Program to find whether a no Link Link
is power of two
Find position of the only set Link Link
bit
Copy set bits in a range Link Link
Divide two integers without
using multiplication, division Link Link
and mod operator
Calculate square of a number Link Link
without using *, / and pow()
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 Link Link
Minimum number of Coins
Maximum trains for which Link Link
stoppage can be provided
Minimum Platforms Problem Link Link
Buy Maximum Stocks if i
stocks can be bought on i-th Link Link
day
Find the minimum and
maximum amount to buy all N Link Link
candies
Minimize Cash Flow among a
given set of friends who have Link
Link
borrowed money from each
other
Minimum Cost to cut a board Link
Link
into squares
Check if it is possible to Link Link
survive on Island
Find maximum meetings in Link Link
one room
Maximum product subset of an Link
Link
array
Maximize array sum after K Link Link
negations
Maximize the sum of arr[i]*i Link Link
Maximum sum of absolute Link Link
difference of an array
Maximize sum of consecutive Link Link
differences in a circular array
Minimum sum of absolute
difference of pairs of two Link Link
arrays
Program for Shortest Job First Link
Link
(or SJF) CPU Scheduling
Program for Least Recently
Used (LRU) Page Link Link
Replacement algorithm
Smallest subset with sum Link Link
greater than all other elements
Chocolate Distribution Link Link
Problem
DEFKIN -Defense of a Link
Link
Kingdom
DIEHARD -DIE HARD Link Link
GERGOVIA -Wine trading in Link
Link
Gergovia
Picking Up Chicks Link Link
CHOCOLA –Chocolate Link Link
ARRANGE -Arranging Link
Link
Amplifiers
K Centers Problem Link Link
Minimum Cost of ropes Link Link
Find smallest number with
given number of digits and Link Link
sum of digits
Rearrange characters in a
string such that no two Link Link
adjacent are same
Find maximum sum possible Link Link
equal sum of three stacks
Backtracking
Question Article Practice
Rat in a maze Problem Link Link
Printing all solutions in N- Link Link
Queen
Word Break Problem using Link Link
Backtracking
Remove Invalid Parentheses Link Link
Sudoku Solver Link Link
M Coloring Problem Link Link
Print all palindromic partitions Link
Link
of a string
Subset Sum Problem Link Link
The Knight’s tour problem Link Link
Tug of War Link Link
Find shortest safe route in a Link Link
path with landmines
Combinational Sum Link Link
Find Maximum number
possible by doing at-most K Link Link
swaps
Print all permutations of a Link Link
string
Find if there is a path of more Link
Link
than k length from a source
Longest Possible Route in a Link Link
Matrix with Hurdles
Print all possible paths from
top left to bottom right of a Link Link
mXn matrix
Partition of a set into K subsets Link Link
with equal sum
Find the K-th Permutation
Sequence of first N natural Link Link
numbers
Dynamic Programming
Question Article Practice
Coin Change Problem Link Link
Knapsack Problem Link Link
Binomial Coefficient Problem Link Link
Permutation Coefficient Link Link
Problem
Program for nth Catalan Link Link
Number
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 Link Link
Problem
Painting the Fence problem Link Link
Maximize The Cut Segments Link Link
Longest Common Link Link
Subsequence
Longest Repeated Link Link
Subsequence
Longest Increasing Link Link
Subsequence
Space Optimized Solution of Link Link
LCS
LCS (Longest Common Link Link
Subsequence) of three strings
Maximum Sum Increasing Link Link
Subsequence
Count all subsequences having Link
Link
product less than K
Longest subsequence such that
difference between adjacent is Link Link
one
Maximum subsequence sum
such that no three are Link Link
consecutive
Egg Dropping Problem Link Link
Maximum Length Chain of Link Link
Pairs
Maximum size square sub- Link Link
matrix with all 1s
Maximum sum of pairs with Link Link
specific difference
Min Cost Path Problem Link Link
Maximum difference of zeros Link Link
and ones in binary string
Minimum number of jumps to Link Link
reach end
Minimum cost to fill given Link Link
weight in a bag
Minimum removals from array Link
Link
to make max –min <= K
Longest Common Substring Link Link
Count number of ways to Link Link
reach a given score in a game
Count Balanced Binary Trees Link Link
of Height h
LargestSum Contiguous Link Link
Subarray [V>V>V>V IMP ]
Smallest sum contiguous Link Link
subarray
Unbounded Knapsack Link Link
(Repetition of items allowed)
Word Break Problem Link Link
Largest Independent Set Link Link
Problem
Partition problem Link Link
Longest Palindromic Link Link
Subsequence
Count All Palindromic Link Link
Subsequence in a given String
Longest Palindromic Substring Link Link
Longest alternating Link Link
subsequence
Weighted Job Scheduling Link Link
Coin game winner where every Link
Link
player has three choices
Count Derangements
(Permutation such that no Link Link
element appears in its original
position) [ IMPORTANT ]
Maximum profit by buying
and selling a share at most Link Link
twice [ IMP ]
Optimal Strategy for a Game Link Link
Optimal Binary Search Tree Link Link
Palindrome Partitioning Link Link
Problem
Word Wrap Problem Link Link
Mobile Numeric Keypad Link Link
Problem [ IMP ]
Boolean Parenthesization Link Link
Problem
Largest rectangular sub-matrix Link
Link
whose sum is 0
Largest area rectangular sub-
matrix with equal number of Link Link
1’s and 0’s [ IMP ]
Maximum sum rectangle in a Link Link
2D matrix
Maximum profit by buying
and selling a share at most k Link Link
times
Find if a string is interleaved Link Link
of two other strings
Maximum Length of Pair Link Link
Chain
Stacks and Queues
Question Article Practice
Implement Stack from Scratch Link Link
Implement Queue from Link Link
Scratch
Implement 2 stack in an array Link Link
Find the middle element of a Link Link
stack
Implement “N” stacks in an Link Link
Array
Check the expression has valid Link Link
or Balanced parenthesis or not.
Reverse a String using Stack Link Link
Design a Stack that supports
getMin() in O(1) time and Link Link
O(1) extra space.
Find the next Greater element Link Link
The celebrity Problem Link Link
Arithmetic Expression Link Link
evaluation
Evaluation of Postfix Link Link
expression
Implement a method to insert
an element at its bottom Link Link
without using any other data
structure.
Reverse a stack using Link Link
recursion
Sort a Stack using recursion Link Link
Merge Overlapping Intervals Link Link
Largest rectangular Area in Link Link
Histogram
Length of the Longest Valid Link Link
Substring
Expression contains redundant Link
Link
bracket or not
Implement Stack using Queue Link Link
Implement Stack using Deque Link Link
Stack Permutations (Check if
an array is stack permutation Link Link
of other)
Implement Queue using Stack Link Link
Implement “n” queue in an Link Link
array
Implement a Circular queue Link Link
LRU Cache Implementation Link Link
Reverse a Queue using Link Link
recursion
Reverse the first “K” elements Link Link
of a queue
Interleave the first half of the Link Link
queue with second half
Find the first circular tour that Link Link
visits all Petrol Pumps
Minimum time required to rot Link Link
all oranges
Distance of nearest cell having Link Link
1 in a binary matrix
First negative integer in every Link Link
window of size “k”
Check if all levels of two trees Link
Link
are anagrams or not.
Sum of minimum and
maximum elements of all Link Link
subarrays of size “k”.
Minimum sum of squares of
character counts in a given Link Link
string after removing “k”
characters.
Queue based approach or first
non-repeating character in a Link Link
stream.
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 Link
Link
using recursion and Iteration
Preorder Traversal of a tree
both using recursion and Link Link
Iteration
Postorder Traversal of a tree
both using recursion and Link Link
Iteration
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 Link Link
tree
Check if a tree is balanced or Link Link
not
Diagonal Traversal of a Binary Link Link
tree
Boundary traversal of a Binary Link Link
tree
Construct Binary Tree from
String with Bracket Link Link
Representation
Convert Binary tree into Link Link
Doubly Linked List
Convert Binary tree into Sum Link Link
tree
Construct Binary tree from Link Link
Inorder and preorder traversal
Find minimum swaps required
to convert a Binary tree into Link Link
BST
Check if Binary tree is Sum Link Link
tree or not
Check if all leaf nodes are at Link Link
same level or not
Check if a Binary Tree
contains duplicate subtrees of Link Link
size 2 or more [ IMP ]
Check if 2 trees are mirror or Link Link
not
Sum of Nodes on the Longest Link Link
path from root to leaf node
Check if given graph is tree or Link
Link
not. [ IMP ]
Find Largest subtree sum in a Link
Link
tree
Maximum Sum of nodes in
Binary tree such that no two Link Link
are adjacent
Print all “K” Sum paths in a Link Link
Binary tree
Find LCA in a Binary tree Link Link
Find distance between 2 nodes Link Link
in a Binary tree
Kth Ancestor of node in a Link Link
Binary tree
Find all Duplicate subtrees in a Link Link
Binary tree [ IMP ]
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 Link Link
BST
Find inorder successor and Link Link
inorder predecessor in a BST
Check if a tree is a BST or not Link Link
Populate Inorder successor of Link Link
all nodes
Find LCA of 2 nodes in a Link Link
BST
Construct BST from preorder Link
Link
traversal
Convert Binary tree into BST Link Link
Convert a normal BST into a Link Link
Balanced BST
Merge two BST Link Link
[ V.V.V>IMP ]
Find Kth largest element in a Link Link
BST
Find Kth smallest element in a Link Link
BST
Count pairs from 2 BST whose
sum is equal to given value Link Link
“X”
Find the median of BST in Link Link
O(n) time and O(1) space
Count BST nodes that lie in a Link Link
given range
Replace every element with
the least greater element on its Link Link
right
Given “n” appointments, find Link
Link
the conflicting appointments
Check preorder is valid or not Link Link
Check whether BST contains Link Link
Dead end
Largest BST in a Binary Tree [ Link Link
V.V.V.V.V IMP ]
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 Link Link
Graph using BFS/DFS Algo
Detect Cycle in UnDirected Link Link
Graph using BFS/DFS Algo
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 Link Link
Directed Acyclic Graph
Find whether it is possible to
finish all tasks or not from Link Link
given dependencies
Find the no. of Islands Link Link
Given a sorted Dictionary of
an Alien Language, find order Link Link
of characters
Implement Link Link
Kruksal’sAlgorithm
Implement Prim’s Algorithm Link Link
Total no. of Spanning tree in a Link
Link
graph
Implement Bellman Ford Link Link
Algorithm
Implement Floyd warshall Link Link
Algorithm
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 Link Link
Components(Kosaraju Algo)
Check whether a graph is Link Link
Bipartite or Not
Detect Negative cycle in a Link Link
graph
Longest path in a Directed Link Link
Acyclic Graph
Journey to the Moon Link Link
Cheapest Flights Within K Link Link
Stops
Oliver and the Game Link Link
Water Jug problem using BFS Link Link
Find if there is a path of more Link
Link
thank length from a source
M-Colouring Problem Link Link
Minimum edges to reverse to
make path from source to Link Link
destination
Paths to travel each nodes
using each edge(Seven Link Link
Bridges)
Vertex Cover Problem Link Link
Chinese Postman or Route Link Link
Inspection
Number of Triangles in a
Directed and Undirected Link Link
Graph
Minimise the cashflow among
a given set of friends who have Link
Link
borrowed money from each
other
Two Clique Problem Link Link
Heap
Question Article Practice
Implement a
Maxheap/MinHeap using Link Link
arrays and recursion.
Sort an Array using heap. Link Link
(HeapSort)
Maximum of all subarrays of Link Link
size k.
“K” largest element in an array Link Link
Kth smallest and largest Link Link
element in an unsorted array
Merge “K” sorted arrays. Link Link
[ IMP ]
Merge 2 Binary Max Heaps Link Link
Kth largest sum continuous Link Link
subarrays
Leetcode- reorganize strings Link Link
Merge “K” Sorted Linked Link Link
Lists [V.IMP]
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 Link Link
minimum cost
Convert BST to Min Heap Link Link
Convert min heap to max heap Link Link
Rearrange characters in a
string such that no two Link Link
adjacent are same.
Minimum sum of two numbers Link Link
formed from digits of an array
Trie
Question Article Practice
Construct a trie from scratch Link Link
Find shortest unique prefix for Link
Link
every word in a given list
Word Break Problem | (Trie Link Link
solution)
Given a sequence of words, Link Link
print all anagrams together
Implement a Phone Directory Link Link
Print unique rows in a given Link Link
boolean matrix
Last Updated : 05 Apr, 2023
418
Similar Reads
1.jQuery Cheat Sheet – A Basic Guide to jQuery
2.Apple SDE Sheet: Interview Questions and Answers
3.SDE SHEET - A Complete Guide for SDE Preparation
4.HTML Cheat Sheet - A Basic Guide to HTML
5.CSS Cheat Sheet - A Basic Guide to CSS
6.Amazon SDE Sheet: Interview Questions and Answers
7.Netflix SDE Sheet: Interview Questions and Answers
8.HCL SDE Sheet: Interview Questions and Answers
9.Nmap Cheat Sheet
10.Computer Network - Cheat Sheet
Practice
Done