Imp que

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

‭Must Do Questions :-‬

‭Linked list‬
‭ .‬
1 ‭ everse the linked list.‬
R
‭2.‬ ‭Middle of linked list.‬
‭3.‬ ‭Reverse linked list in k order.‬
‭4.‬ ‭Check circular list.‬
‭5.‬ ‭Detect and Remove Loops in Sorted /Unsorted linked list.‬
‭6.‬ ‭Sort 0’s 1’s 2’s in linked list.‬
‭7.‬ ‭Merge 2 sorted linked lists.‬
‭8.‬ ‭Palindrome linked list.‬
‭9.‬ ‭Add 2 numbers using linked list.‬
‭10.‬ ‭Clone linked list with random pointer.‬
‭11.‬ ‭Merge Sort in linked list.‬
‭12.‬ ‭Flatten linked list.‬

‭Stack And Queue‬

‭ .‬ ‭Nearest Greater to left.‬


1
‭2.‬ ‭Nearest Graeter to right.‬
‭3.‬ ‭Nearest smaller to left‬
‭4.‬ ‭Nearest Smaller to right‬
‭5.‬ ‭Stack Span problem‬
‭6.‬ ‭Maximum Area of Histogram‬
‭7.‬ ‭Max Area of rectangle in Binary Matrix.‬
‭8.‬ ‭Rain Water Trapping.‬
‭9.‬ ‭Implementing a Min Stack.‬
‭10.‬ ‭Implementing Stack Using Heap.‬
‭11.‬ ‭The Celebrity Problem‬
‭12.‬ ‭Longest Valid Parenthesis.‬
‭13.‬ ‭Iterative TOH.‬
‭Sliding Window‬

‭‬
● ‭ ax/Min Subarray of Size K.‬
M
‭●‬ ‭1st negative in every window size of K‬
‭●‬ ‭Count occurrence of anagram‬
‭●‬ ‭Max of all Subarray of Size K‬
‭●‬ ‭Max of Min for every min size.‬
‭●‬ ‭Largest/Smallest Subarray of Sum K‬
‭●‬ ‭Largest substring of K distinct characters.‬
‭●‬ ‭Length of largest substring with no repeating characters‬
‭●‬ ‭Pick Toys‬
‭●‬ ‭Minimum window Substring‬

‭Tree‬

‭ .‬ ‭Inorder traversal‬
1
‭2.‬ ‭Preorder traversal‬
‭3.‬ ‭Postorder traversal‬
‭4.‬ ‭Level order traversal‬
‭5.‬ ‭Iterative inorder , preorder and postorder‬
‭6.‬ ‭Maximum depth of binary tree‬
‭7.‬ ‭Check for balance tree‬
‭8.‬ ‭Diameter of binary tree‬
‭9.‬ ‭Maximum path sum‬
‭10.‬ ‭Check if two tree identical or not‬
‭11.‬ ‭Zigzag traversal‬
‭12.‬ ‭Boundary traversal‬
‭13.‬ ‭Vertical order traversal‬
‭14.‬ ‭Top view of binary tree‬
‭15.‬ ‭Bottom view of binary tree.‬
‭16.‬ ‭Right/left view of binary tree‬
‭ 7.‬
1 ‭ ymmetric Binary tree‬
S
‭18.‬ ‭Root to node path‬
‭19.‬ ‭Lowest common ancestor‬
‭20.‬ ‭Maximum width of binary tree‬
‭21.‬ ‭Children sum property‬
‭22.‬ ‭All nodes at distance k‬
‭23.‬ ‭Minimum time to burn binary tree from any node‬
‭24.‬ ‭Requirement to construct binary tree‬
‭25.‬ ‭Construct binary tree using inorder and preorder‬
‭26.‬ ‭Construct binary tree using inorder and postorder‬
‭27.‬ ‭Serialize and deserialize binary tree‬
‭28.‬ ‭Morris traversal‬
‭29.‬ ‭Flatten binary tree to linked list‬

‭BST‬

‭ .‬ ‭Bst me insertion search and deletion‬


1
‭2.‬ ‭Validate binary search tree or check if bst or not‬
‭3.‬ ‭Find kth smallest element in bst‬
‭4.‬ ‭Find kth element in bst using morris traversal‬
‭5.‬ ‭Predecessor and successor in bst‬
‭6.‬ ‭Lca in bst‬
‭7.‬ ‭Two sum in bst‬
‭8.‬ ‭Flatten bst in sorted linked list‬
‭9.‬ ‭Normal Bst to balanced bst‬
‭10.‬ ‭Preorder traversal of bst‬
‭11.‬ ‭Merge to bst‬
‭12.‬ ‭Largest bst‬

‭Graph‬
‭ .‬ ‭Bfs Traversal‬
1
‭2.‬ ‭Dfs Traversal‬
‭3.‬ ‭Number of provinces‬
‭4.‬ ‭Connected component in matrix‬
‭5.‬ ‭Rotten oranges‬
‭6.‬ ‭Flood fills‬
‭7.‬ ‭Cycle detection in Undirected graph(Bfs)‬
‭8.‬ ‭Cycle detection in Undirected graph(Dfs)‬
‭9.‬ ‭Word Ladder-1‬
‭10.‬ ‭Word Ladder-2‬
‭11.‬ ‭Bipartite Graph(Dfs)‬
‭12.‬ ‭Cycle Detection in Directed Graph(Dfs)‬
‭13.‬ ‭Topological Sort‬
‭14.‬ ‭Kahn’s Algorithm‬
‭15.‬ ‭Cycle detection in directed Graph(Bfs)‬
‭16.‬ ‭Course Scheduler-1‬
‭17.‬ ‭Course Scheduler-2‬
‭18.‬ ‭Dijkstra Algorithms‬
‭19.‬ ‭Bellmans Ford Algo‬
‭20.‬ ‭Minimum spanning Tree‬
‭21.‬ ‭Prims Algorithms‬
‭22.‬ ‭Disjoint Set (by rank/size)‬
‭23.‬ ‭Kruskal Algorithms‬
‭24.‬ ‭Bridge in Graph‬
‭25.‬ ‭Kosaraju’s Algorithms‬

‭Recursion/Backtracking‬

‭ .‬ ‭Print all subsequences‬


1
‭2.‬ ‭Print all subsequences whose sum is k‬
‭3.‬ ‭Print any subsequences whose sum is k‬
‭4.‬ ‭Count the subsequences with sum k‬
‭ .‬ ‭Combinational Sum-1‬
5
‭6.‬ ‭Combinational Sum-2‬
‭7.‬ ‭Subset Sum-1‬
‭8.‬ ‭Subset Sum-2‬
‭9.‬ ‭Permutations‬
‭10.‬ ‭N Queen‬
‭11.‬ ‭Validate Sudoku‬
‭12.‬ ‭Sudoku Solver‬
‭13.‬ ‭Rat in Maze‬
‭14.‬ ‭Knight Tour‬
‭15.‬ ‭Joseph Problem (Game of Life)‬
‭16.‬ ‭Palindrome Partitioning‬
‭17.‬ ‭Permutation Sequences‬
‭18.‬ ‭Partition K subsets‬
‭19.‬ ‭Count the number of ways to divide N into k‬

‭Heap‬

‭ .‬ ‭Max Heap/Min Heap‬


1
‭2.‬ ‭Heapify Algorithms‬
‭3.‬ ‭Priority Queue‬
‭4.‬ ‭Kth Smallest Element‬
‭5.‬ ‭Return K Largest Elements‬
‭6.‬ ‭Sort K sorted Array‬
‭7.‬ ‭K smallest Numbers‬
‭8.‬ ‭Top K frequent Numbers‬
‭9.‬ ‭Frequency sort‬
‭10.‬ ‭K closest Point to Origin‬
‭11.‬ ‭Connect Ropes to Minimize Cost‬
‭12.‬ ‭Sum of Smallest between k1 smallest and K2 smallest‬
‭Number‬
‭ 3.‬
1 ‭ erge K sorted List‬
M
‭14.‬ ‭Task Scheduler‬
‭15.‬ ‭Hands Of straight‬
‭16.‬ ‭Design Twitter‬
‭17.‬ ‭Find Median From Data Stream‬

‭Array‬

‭ .‬ ‭Find the duplicate Number‬


1
‭2.‬ ‭Sort Color‬
‭3.‬ ‭Move Zeroes‬
‭4.‬ ‭Best Time to buy and sell stock‬
‭5.‬ ‭Two sum‬
‭6.‬ ‭Best time to buy and sell stock-2‬
‭7.‬ ‭Container with most water‬
‭8.‬ ‭3 sum‬
‭9.‬ ‭Subarray sum divisible by K‬
‭10.‬ ‭Find all Duplicates in an Array‬
‭11.‬ ‭Trapping Rainwater‬
‭12.‬ ‭Spiral Matrix‬
‭13.‬ ‭Jump Game‬
‭14.‬ ‭Word Search‬
‭15.‬ ‭Word Search-2‬
‭16.‬ ‭Majority Element‬
‭17.‬ ‭Reverse Pairs‬
‭18.‬ ‭Valid Parentheses‬
‭19.‬ ‭Set Matrix Zeroes‬
‭20.‬ ‭Maximum Sum subarray‬
‭21.‬ ‭Subarray with 0 sum‬
‭22.‬ ‭Subarray Sum Divisible by K‬
‭23.‬ ‭Find All Duplicates in an Array‬
‭ 4.‬
2 ‭ argest Rectangle in Histogram‬
L
‭25.‬ ‭Merge two Sorted Array Without Extra Space‬
‭26.‬ ‭Subarray Sum Equal K‬
‭27.‬ ‭Longest Common Prefix‬
‭28.‬ ‭Valid palindrome-2‬
‭29.‬ ‭Generate Parentheses‬
‭30.‬ ‭Pattern Matching Algorithms‬
‭31.‬ ‭Group Anagrams‬
‭32.‬ ‭Remove Duplicate Letters‬
‭33.‬ ‭Word Break‬
‭34.‬ ‭Insert Intervals‬
‭35.‬ ‭Merge Intervals‬
‭36.‬ ‭N Meeting in One Room‬
‭37.‬ ‭Meeting Room-1‬
‭38.‬ ‭Meeting Room-2‬
‭39.‬ ‭Search in Rotated Array‬
‭40.‬ ‭Product of Array Except Itself‬
‭41.‬ ‭Number of 1 Bits‬
‭42.‬ ‭Dec to Binary‬
‭43.‬ ‭Counting Bits 1 to N‬
‭44.‬ ‭Reverse Bits‬
‭45.‬ ‭Missing Numbers‬
‭46.‬ ‭Rotate Image‬
‭47.‬ ‭Happy Number‬
‭48.‬ ‭Alien Dictionary‬
‭49.‬ ‭Find Median From Data Stream‬

‭DP‬

‭ .‬ ‭Fibonacci‬
1
‭2.‬ ‭Climbing Stairs‬
‭3.‬ ‭Frog Jump‬
‭ .‬ ‭Frog jump with K distance‬
4
‭5.‬ ‭Maximum Sum of Non Adjacent Elements‬
‭6.‬ ‭House Robber 2‬
‭7.‬ ‭Ninja Training‬
‭8.‬ ‭Grid Unique Paths‬
‭9.‬ ‭Unique Path-2‬
‭10.‬ ‭Minimum/MaximumFalling Path Sum‬
‭11.‬ ‭Cherry Pickup‬
‭12.‬ ‭Subset Sum Equal to Target‬
‭13.‬ ‭Partition Equal Subset Sum‬
‭14.‬ ‭Partition a set into two subsets with minimum absolute sum‬
‭difference‬
‭15.‬ ‭Count subsets with sum K‬
‭16.‬ ‭Count partition with given difference‬
‭17.‬ ‭0/1 Knapsacks‬
‭18.‬ ‭Minimum Coins‬
‭19.‬ ‭Target Sum‬
‭20.‬ ‭Coin change-2‬
‭21.‬ ‭Unbounded Knapsacks‬
‭22.‬ ‭Rod cutting problem‬
‭23.‬ ‭Longest common subsequences‬
‭24.‬ ‭Longest palindrome subsequences‬
‭25.‬ ‭Minimum insertion to make string palindromic‬
‭26.‬ ‭Minimum insertion to convert string A to string B‬
‭27.‬ ‭Shortest Common Supersequences‬
‭28.‬ ‭Distinct Subsequences‬
‭29.‬ ‭Edit Distances‬
‭30.‬ ‭WildCard Matching‬
‭31.‬ ‭Best Time to Buy And Sell Stock‬
‭32.‬ ‭Buy And Sell Stock -2‬
‭33.‬ ‭Buy And Sell Stock-3‬
‭34.‬ ‭Buy And Sell Stock-4‬
‭35.‬ ‭Buy And Sell Stock with Cooldown‬
‭36.‬ ‭Buy And Sell Stock With Transaction Fee‬
‭37.‬ ‭Longest Increasing Subsequences‬
‭ 8.‬ ‭Longest Divisible Subset‬
3
‭39.‬ ‭Longest String Chain‬
‭40.‬ ‭Longest Bitonic Subsequences‬
‭41.‬ ‭Number of Increasing (Longest) Subsequences‬
‭42.‬ ‭Matrix Chain Multiplication‬
‭43.‬ ‭Minimum Cost to cut the stick‬
‭44.‬ ‭Burst balloons‬
‭45.‬ ‭Evaluate boolean expression to true‬
‭46.‬ ‭Palindrome partitioning-2‬
‭47.‬ ‭Partition Array for Maximum Sum‬
‭48.‬ ‭Maximum rectangle area with all 1’s count square‬
‭submatrices with all one‬

‭Binary Search‬

‭1.‬ ‭Binary Search Code‬


‭ .‬ ‭1st and last position of an element in sorted Array‬
2
‭3.‬ ‭Total No. of occurrences or count of element in sorted‬
‭array‬
‭4.‬ ‭Peak Index in a Mountain Array‬
‭5.‬ ‭Find Pivot in an Array‬
‭6.‬ ‭Search in rotated sorted Array‬
‭7.‬ ‭Square Root Using Binary Search‬
‭8.‬ ‭Book Allocation Problem‬
‭9.‬ ‭Aggressive Cows‬
‭10.‬

You might also like