BASICS
Count Digits
Reverse a Number
Check Palindrome
GCD Or HCF
Armstrong Numbers
Print all Divisors
Check for Prime
BASIC RECURSION
Understand recursion by print something N times
Print name N times using recursion
Print 1 to N using recursion
Print N to 1 using recursion
Sum of first N numbers
Factorial of N numbers
Reverse an array
Check if a string is palindrome or not
Fibonacci Number
SORTING
Selection Sort
Bubble Sort
Insertion Sort
Merge Sort
Recursive Bubble Sort
Recursive Insertion Sort
Quick Sort
ARRAY
Largest Element in an Array
Second Largest Element in an Array without sorting
Check if the array is sorted
Remove duplicates from Sorted array
Left Rotate an array by one place
Left rotate an array by D places
Move Zeros to end
Linear Search
Find the Union and intersection of two sorted arrays
Find missing number in an array
Maximum Consecutive Ones
Find the number that appears once, and other numbers twice.
Longest subarray with given sum(Positives)
Longest subarray with given sum(Positives + Negatives)
2Sum Problem
Sort an array of 0’s 1’s and 2’s
Majority Element (>n/2 times)
Kadane’s Algorithm, maximum subarray sum
Print the subarray with maximum sum
Stock Buy and Sell
Rearrange the array in alternating positive and negative items
Next Permutation
Leaders in an Array problem
Longest Consecutive Sequence in an Array
Set Matrix Zeros
Rotate Matrix by 90 degrees
Print the matrix in spiral manner
Find number of subarrays with sum K
Pascal’s Triangle
Majority Element (n/3 times)
3-Sum Problem
4-Sum Problem
Count number of subarrays with given xor K
Merge Overlapping Subintervals
Merge two sorted arrays without extra space
Find the repeating and missing number
Count Inversions
Reverse Pairs
Maximum Product Subarray
: Binary Search [1D, 2D Arrays, Search Space]
Binary Search to find X in sorted array
Find the row with maximum number of 1’s
Implement Lower Bound
Implement Upper Bound
Search Insert Position
Check if Input array is sorted
Find the first or last occurrence of a given number in a sorted array
Count occurrences of a number in a sorted array with duplicates
Find peak element
Search in Rotated Sorted Array I
Search in Rotated Sorted Array II
Find minimum in Rotated Sorted Array
Single element in a Sorted Array
Find kth element of two sorted arrays
Find out how many times has an array been rotated
Search in a 2 D matrix
Find Peak Element
Matrix Median
: Find Answers by BS in Search Space
Find square root of a number in log n
Find the Nth root of a number using binary search
Koko Eating Bananas
Minimum days to make M bouquets
Find the smallest Divisor
Capacity to Ship Packages within D Days
Median of two sorted arrays
Aggressive Cows
Book Allocation Problem
Split array – Largest Sum
Kth Missing Positive Number
Minimize Max Distance to Gas Station
Median of 2 sorted arrays
Kth element of 2 sorted arrays
STRINGS
:Easy String Problems
Remove outermost Paranthesis
Reverse words in a given string / Palindrome Check
Largest odd number in a string
Longest Common Prefix
Isomorphic String
check whether one string is a rotation of another
Check if two strings are anagram of each other
: Medium String Problems
Sort Characters by frequency
Maximum Nesting Depth of Paranthesis
Roman Number to Integer and vice versa
Implement Atoi
Count Number of Substrings
Longest Palindromic Substring[Do it without DP]
Sum of Beauty of all substring
Reverse Every Word in A String
Topic/Article
LINKED LIST--
Introduction to LinkedList, learn about struct, and how is node represented
Inserting a node in LinkedList
Deleting a node in LinkedList
Find the length of the Linkedlist [learn traversal]
Search an element in the LL
Step 6.2
: Learn Doubly LinkedList
Introduction to DLL, learn about struct, and how is node represented
Insert a node in DLL
Delete a node in DLL
Reverse a DLL
Step 6.3
: Medium Problems of LL
Middle of a LinkedList [TortoiseHare Method]
Reverse a LinkedList [Iterative]
Reverse a LL [Recursive]
Detect a loop in LL
Find the starting point in LL
Length of Loop in LL
Check if LL is palindrome or not
Segrregate odd and even nodes in LL
Remove Nth node from the back of the LL
Delete the middle node of LL
Sort LL
Sort a LL of 0’s 1’s and 2’s by changing links
Find the intersection point of Y LL
Add 1 to a number represented by LL
Add 2 numbers in LL
Step 6.5
: Hard Problems of LL
Reverse LL in group of given size K
Rotate a LL
Flattening of LL
Clone a Linked List with random and next pointer
RECURSION
Recursive Implementation of atoi()
Pow(x, n)
Count Good numbers
Sort a stack using recursion
Reverse a stack using recursion
Step 7.2
: Subsequences Pattern
Generate all binary strings
Generate Paranthesis
Print all subsequences/Power Set
Learn All Patterns of Subsequences (Theory)
Count all subsequences with sum K
Check if there exists a subsequence with sum K
Combination Sum
Combination Sum-II
Subset Sum-I
Subset Sum-II
Combination Sum – III
Letter Combinations of a Phone number
Step 7.3
: Trying out all Combos / Hard
Palindrome Partitioning
Word Search
N Queen
Rat in a Maze
Word Break
M Coloring Problem
Sudoko Solver
Expression Add Operators
Step 8
: Bit Manipulation [Concepts & Problems] & Advanced Maths
It is one of the smallest topics in DSA, learn the basic concepts.
There are only few problems which are repeatedly asked in Interviews which have
been added.
Step 8.1
: Learn Bit Manipulation
Introduction to Bit Manipulation [Theory]
Check if the i-th bit is set or not
Check if a number is odd or not
Check if a number is power of 2 or not
Count the number of set bits
Set/Unset the rightmost unset bit
Swap two numbers
Divide two integers without using multiplication, division and mod operator
Step 8.2
: Interview Problems
Count number of bits to be flipped to convert A to B
Find the number that appears odd number of times
Power Set
Fnd xor of numbers from L to R
Find the two numbers appearing odd number of times
Step 8.3
: Advanced Maths
Print Prime Factors of a Number
All Divisors of a Number
Sieve of Eratosthenes
Find Prime Factorisation of a Number using Sieve
Power(n, x)
Step 9
: Stack and Queues [Pre-In-Post-fix, Monotonic Stack]
Step 9.1
: Learning
Implement Stack using Arrays
Implement Queue using Arrays
Implement Stack using Queue
Implement Queue using Stack
Implement stack using Linkedlist
Implement queue using Linkedlist
Check for balanced paranthesis
Implement Min Stack
Step 9.2
: Prefix, Infix, PostFix Conversion Problems
Infix to Postfix Conversion using Stack
Prefix to Infix Conversion
Prefix to Postfix Conversion
Postfix to Prefix Conversion
Postfix to Infix
Convert Infix To Prefix Notation
Step 9.3
: Monotonic Stack/Queue Problems [VVV. Imp]
Next Greater Element
Next Greater Element 2
Next Smaller Element
Number of NGEs to the right
Trapping Rainwater
Sum of subarray minimum
Stock span problem
Asteroid Collision
Sum of subarray ranges
Remove k Digits
Largest rectangle in a histogram
Maximal Rectangles
Step 9.4
: Implementation Problems
Sliding Window maximum
Stock Span Problem
The Celebrity Problem
Rotten Oranges
LRU cache (IMPORTANT)
LFU cache
Step 10
: Sliding Window & Two Pointer Combined Problems
Step 10.1
: Medium Problems
Longest Substring Without Repeating Characters
Max Consecutive Ones III
Fruit Into Baskets
longest repeating character replacement
Binary subarray with sum
Count number of nice subarrays
Number of substring containing all three characters
Maximum point you can obtain from cards
Step 10.2
:
Longest Substring with At Most K Distinct Characters
Subarray with k different integers
Minimum Window Substring
Minimum Window Subsequence
Step 11
: Heaps [Learning, Medium, Hard Problems]
Step 11.1
Introduction to Priority Queues using Binary Heaps
Min Heap and Max Heap Implementation
Check if an array represents a min-heap or not
Convert min Heap to max Heap
Step 11.2
: Medium Problems
Kth largest element in an array [use priority queue]
Kth smallest element in an array [use priority queue]
Sort K sorted array
Merge M sorted Lists
Replace each array element by its corresponding rank
Task Scheduler
Hands of Straights
Step 11.3
: Hard Problems
Design twitter
Connect `n` ropes with minimal cost
Kth largest element in a stream of running integers
Maximum Sum Combination
Find Median from Data Stream
K most frequent elements
Step 12
: Greedy Algorithms [Easy, Medium/Hard]
Step 12.1
: Easy Problems
Assign Cookies
Fractional Knapsack Problem
Greedy algorithm to find minimum number of coins
Lemonade Change
Valid Paranthesis Checker
Step 12.2
: Medium/Hard
N meetings in one room
Jump Game
Jump Game 2
Minimum number of platforms required for a railway
Job sequencing Problem
Candy
Program for Shortest Job First (or SJF) CPU Scheduling
Program for Least Recently Used (LRU) Page Replacement Algorithm
Insert Interval
Merge Intervals
Non-overlapping Intervals
TREES
Step 13
Step 13.1
: Traversals
Introduction to Trees
Binary Tree Representation in C++
Binary Tree Representation in Java
Binary Tree Traversals in Binary Tree
Preorder Traversal of Binary Tree
Inorder Traversal of Binary Tree
Post-order Traversal of Binary Tree
Level order Traversal / Level order traversal in spiral form
Iterative Preorder Traversal of Binary Tree
Iterative Inorder Traversal of Binary Tree
Post-order Traversal of Binary Tree using 2 stack
Post-order Traversal of Binary Tree using 1 stack
Preorder, Inorder, and Postorder Traversal in one Traversal
Step 13.2
: Medium Problems
Height of a Binary Tree
Check if the Binary tree is height-balanced or not
Diameter of Binary Tree
Maximum path sum
Check if two trees are identical or not
Zig Zag Traversal of Binary Tree
Boundary Traversal of Binary Tree
Vertical Order Traversal of Binary Tree
Top View of Binary Tree
Bottom View of Binary Tree
Right/Left View of Binary Tree
Symmetric Binary Tree
Step 13.1
: Hard Problems
Root to Node Path in Binary Tree
LCA in Binary Tree
Maximum width of a Binary Tree
Check for Children Sum Property
Print all the Nodes at a distance of K in a Binary Tree
Minimum time taken to BURN the Binary Tree from a Node
Count total Nodes in a COMPLETE Binary Tree
Requirements needed to construct a Unique Binary Tree | Theory
Link
Construct Binary Tree from inorder and preorder
Construct the Binary Tree from Postorder and Inorder Traversal
Serialize and deserialize Binary Tree
Morris Preorder Traversal of a Binary Tree
Morris Inorder Traversal of a Binary Tree
Flatten Binary Tree to LinkedList
Step 14
: Binary Search Trees [Concept and Problems]
: Concepts
Introduction to Binary Search Tree
Search in a Binary Search Tree
Find Min/Max in BST
Step 14.2
: Practice Problems
Ceil in a Binary Search Tree
Floor in a Binary Search Tree
Insert a given Node in Binary Search Tree
Delete a Node in Binary Search Tree
Find K-th smallest/largest element in BST
Check if a tree is a BST or BT
LCA in Binary Search Tree
Construct a BST from a preorder traversal
Inorder Successor/Predecessor in BST
Merge 2 BST’s
Two Sum In BST | Check if there exists a pair with Sum K
Recover BST | Correct BST with two nodes swapped
Largest BST in Binary Tree
Step 15
: Graphs [Concepts & Problems]
Step 15.1
Graph and Types
Graph Representation | C++
Graph Representation | Java
Connected Components | Logic Explanation
BFS
DFS
Step 15.2
: Problems on BFS/DFS
Number of provinces (leetcode)
Connected Components Problem in Matrix
Rotten Oranges
Flood fill
Cycle Detection in unirected Graph (bfs)
Cycle Detection in undirected Graph (dfs)
0/1 Matrix (Bfs Problem)
Surrounded Regions (dfs)
Number of Enclaves [flood fill implementation – multisource]
Word ladder – 1
Word ladder – 2
Number of Distinct Islands [dfs multisource]
Bipartite Graph (DFS)
Cycle Detection in Directed Graph (DFS)
Step 15.3
: Topo Sort and Problems
Topo Sort
Kahn’s Algorithm
Cycle Detection in Directed Graph (BFS)
Course Schedule – I
Course Schedule – II
Find eventual safe states
Alien dictionary
Step 15.4
: Shortest Path Algorithms and Problems
Shortest Path in UG with unit weights
Shortest Path in DAG
Djisktra’s Algorithm
Why priority Queue is used in Djisktra’s Algorithm
Shortest path in a binary maze
Path with minimum effort
Cheapest flights within k stops
Network Delay time
Number of ways to arrive at destination
Minimum steps to reach end from start by performing multiplication and mod
operations with array elements
Bellman Ford Algorithm
Floyd Warshal Algorithm
Find the city with the smallest number of neighbors in a threshold distance
Step 15.5
: MinimumSpanningTree/Disjoint Set and Problems
Minimum Spanning Tree
Prim’s Algorithm
Disjoint Set [Union by Rank]
Disjoint Set [Union by Size]
Kruskal’s Algorithm
Number of operations to make network connected
Most stones removed with same rows or columns
Accounts merge
Number of island II
Making a Large Island
Swim in rising water [HARD]
Step 15.6
: Other Algorithms
Bridges in Graph
Articulation Point
Kosaraju’s Algorithm
Step 16