Arrays
Arrays
Left Rotate an array by one place Left rotate an array by D places Move Zeros to end
Maximum Consecutive Ones Find the number that appears once, and Longest subarray with given sum K
other numbers twice (positives)
Longest subarray with sum K (Positives + 2Sum Problem Sort an array of 0's 1's and 2's
Negatives)
Majority Element (>n/2 times) Kadane's Algorithm, maximum subarray Print subarray with maximum subarray sum
sum
Stock Buy and Sell Rearrange the array in alternating positive Next Permutation
and negative items
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 Count subarrays with given sum
Merge Overlapping Subintervals Merge two sorted arrays without extra space Find the repeating and missing number
Binary Search to find X in sorted array Implement Bound Search Insert Position
Floor/Ceil in Sorted Array Find the first or last occurrence of a given Count occurrences of a number in a sorted
number in a sorted array array with duplicates
Search in Rotated Sorted Array I Search in Rotated Sorted Array II Find minimum in Rotated Sorted Array
Find out how many times has an array been Single element in a Sorted Array Find peak element
rotated
Find square root of a number in log n Find the Nth root of a number using binary Koko Eating Bananas
search
Minimum days to make M bouquets Find the smallest Divisor Capacity to Ship Packages within D Days
Kth Missing Positive Number Aggressive Cows Book Allocation Problem
Split array - Largest Sum Painter's partition Minimize Max Distance to Gas Station
Median of 2 sorted arrays Kth element of 2 sorted arrays Find the row with maximum number of 1's
Search in a 2 D matrix Search in a row and column wise sorted Find Peak Element (2D Matrix)
matrix
Matrix Median
STRINGS
Remove outermost Paranthesis Reverse words in a given string / Palindrome Largest odd number in a string
Check
Longest Common Prefix Isomorphic String check whether one string is a rotation of another
Check if two strings are anagram of each other 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
LINKED LIST
Inserting a node in LinkedList Deleting a node in LinkedList Find the length of the linkedlist
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 Delete all occurrences of a key in DLL
Find pairs with given sum in DLL Remove duplicates from sorted DLL Reverse LL in group of given size K
Generate all binary strings Generate Parenthesis 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
Implement Stack using Arrays Implement Queue using Arrays Implement Stack using Queue
Implement Queue using Stack Implement Stack using Linked List Implement Queue using Linked List
Check for Balanced Parenthesis Implement Min Stack Infix to Postfix Conversion
Prefix to Infix Conversion Prefix to Postfix Conversion Postfix to Prefix Conversion
Next Greater Element 2 Next Smaller Element Number of NGEs to the Right
Trapping Rain Water Sum of Subarray Minimum Asteroid Collision
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
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 Minimum time taken to BURN the Binary Tree
Tree from a Node
Count total Nodes in a COMPLETE Binary Tree Requirements needed to construct a Unique Construct Binary Tree from inorder and preorder
Binary Tree | Theory
Construct the Binary Tree from Postorder and Serialize and deserialize Binary Tree Morris Preorder Traversal of a Binary Tree
Inorder Traversal
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 Recover BST | Correct BST with two nodes
with Sum K swapped
0/1 Matrix (Bfs Problem) Surrounded Regions (dfs) Number of Enclaves [flood fill implementation -
multisource]
Why priority Queue is used in Djisktra's Shortest path in a binary maze Path with minimum effort
Algorithm
Cheapest flights within k stops Network Delay time Number of ways to arrive at destination
Minimum steps to reach end from start by Bellman Ford Algorithm Floyd Warshal Algorithm
performing multiplication and mod operations
with array elements
Find the city with the smallest number of Minimum Spanning Tree Prim's Algorithm
neighbors in a threshold distance
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
Frog Jump with k distances(DP-4) Maximum sum of non-adjacent elements (DP 5) House Robber (DP 6)
Ninja's Training (DP 7) Grid Unique Paths : DP on Grids (DP8) Grid Unique Paths 2 (DP 9)
Minimum path sum in Grid (DP 10) Minimum path sum in Triangular Grid (DP 11) Minimum/Maximum Falling Path Sum (DP-12)
3-d DP : Ninja and his friends (DP-13) Subset sum equal to target (DP- 14) Partition Equal Subset Sum (DP- 15)
Partition Set Into 2 Subsets With Min Absolute Count Subsets with Sum K (DP - 17) Count Partitions with Given Difference (DP - 18)
Sum Diff (DP- 16)
Assign Cookies Minimum Coins (DP - 20) Target Sum (DP - 21)
Coin Change 2 (DP - 22) Unbounded Knapsack (DP - 23) Rod Cutting Problem | (DP - 24)
Longest Common Subsequence | (DP - 25) Print Longest Common Subsequence | (DP - 26) Longest Common Substring | (DP - 27)
Longest Palindromic Subsequence | (DP-28) Minimum insertions to make string palindrome | Minimum Insertions/Deletions to Convert String |
DP-29 (DP- 30)
Shortest Common Supersequence | (DP - 31) Distinct Subsequences| (DP-32) Edit Distance | (DP-33)
Wildcard Matching | (DP-34) Best Time to Buy and Sell Stock |(DP-35) Buy and Sell Stock - II|(DP-36)
Buy and Sell Stocks III|(DP-37) Buy and Stock Sell IV |(DP-38) Buy and Sell Stocks With Cooldown|(DP-39)
Buy and Sell Stocks With Transaction Fee|(DP- Matrix Chain Multiplication|(DP-48) Matrix Chain Multiplication | Bottom-Up|(DP-49)
40)
Minimum Cost to Cut the Stick|(DP-50) Burst Balloons|(DP-51) Evaluate Boolean Expression to True|(DP-52)
Palindrome Partitioning - II|(DP-53) Partition Array for Maximum Sum|(DP-54) Maximum Rectangle Area with all 1's|(DP-55)
Implement Trie - 2 (Prefix Tree) Longest String with All Prefixes Number of Distinct Substrings in a String
Bit PreRequisites for TRIE Problems Maximum XOR of two numbers in an array Maximum XOR With an Element From Array
STRINGS(NEW)
Minimum number of bracket reversals needed to Count and say Hashing In Strings | Theory
make an expression balanced
Shortest Palindrome Longest happy prefix Count palindromic subsequence in given string
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 Substrings Containing All Three Maximum Points You Can Obtain From Cards Longest Substring with At Most K Distinct
Characters Characters
Subarray with K Different Integers Minimum Window Substring Minimum Window Subsequence
HEAPS
Check if an array represents a min-heap or not Convert min Heap to max Heap Kth largest element in an array [use priority
queue]
Kth smallest element in an array [use priority Sort K sorted array Merge M sorted Lists
queue]
Replace each array element by its corresponding Task Scheduler Hands of Straights
rank
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
GREEDY ALGORITHM
Assign Cookies Fractional Knapsack Problem Greedy algorithm to find minimum number of
coins
Program for Least Recently Used (LRU) Page Insert Interval Merge Intervals
Replacement Algorithm
Non-overlapping Intervals
SORTING
Quick Sort