287
Find The Duplicate Number
Floyd’s Algo - not implemented
75
Sort Colors
Used simple Insertion sort.
Or counting sort with multiple passes.
26
Remove Duplicates From Sorted Array
using set() or dict(). (set or vector for c++) 73
Set Matrix Zeroes
separate loops,
scan and edit inplace
283
Move Zeroes
2 pointers
Tricky - removing the “swap redundancy” logic
121
Best Time To Buy And Sell Stock
keep track of previous days minimum buy.
Chocolate Distribution Problem
sliding window and simple loop adjustments
1
Two Sum
hashmap or dictionary
122
Best Time To Buy And Sell Stock II
Seen
Solved
Tricky
Revise
Algo
greedy, basically selling and buying again when a dip in price is found
974
Subarray Sums Divisible By K
HashMap
prefix-sum
modulo-arithmetic
HashMap + modulo arithmetic. Tricky to visualize the subarrays on each step
Find All Duplicates In An Array
HashMap if not space constraints specific use case (optimized)
Container With Most Water
3sum
check for duplicates on outer as well as inner loops
Maximum Points You Can Obtain From Cards
sliding window, but for the remaining items. convert right index to +ve if -ve
Subarray Sum Equals K
visualization is done using the approach of finding the number of times k less pref_sum were present.
Print All Possible Combinations Of R Elements In A Given Array Of Size N
Insert Delete Getrandom O1 Duplicates Allowed
Largest Rectangle In Histogram
Print All The Duplicates In The Input String
Implement Strstr
not really a 2 pointers
just single pointer with right side handling to prevent out of bounds
Longest Common Prefix
take first word as prefix answer compare with the next word, modify if necessary keep doing it with next words
Valid Palindrome Ii
just call the similar function again in case of not match
Generate Parentheses
see the rust part for the backtracking and push pop.
Simplify Path
find all the valid folders of the path, put them into the stack
Smallest Window In A String Containing All The Characters Of Another String 1587115621
Reverse Words In A String
Rabin Karp Algorithm For Pattern Searching
Integer To English Words
Minimum Window Substring
Boyer Moore Algorithm For Pattern Searching
Maximum Size Rectangle Binary Sub Matrix 1s
Given Matrix O X Replace O X Surrounded X
Minimum Moves To Equal Array Elements
Maximum Product Of Three Numbers
Excel Sheet Column Title
Permute Two Arrays Sum Every Pair Greater Equal K
Ceiling In A Sorted Array
Find A Pair With The Given Difference
Permute Two Arrays Sum Every Pair Greater Equal K
Check Reversing Sub Array Make Array Sorted
Make Array Elements Equal Minimum Cost
162
Find Peak Element
simple ambiguous (very easy as the answer may not be unique) Binary search is not mandatory
Allocate Minimum Number Of Pages0937
Minimum Number Swaps Required Sort Array
33
Search In Rotated Sorted Array
Count Of Smaller Numbers After Self
Split Array Largest Sum
876
Middle Of The Linked List
2-pointers
slow-fast-pointers
slow fast pointers, 2 pointers
141
Linked List Cycle
2-pointers
slow-fast-pointers
slow fast pointers, 2 pointers
1290
Convert Binary Number In A Linked List To Integer
83
Remove Duplicates From Sorted List
Sort A Linked List Of 0s 1s Or 2s
203
Remove Linked List Elements
21
Merge Two Sorted Lists
Multiply Two Numbers Represented Linked Lists
160
Intersection Of Two Linked Lists
method 2: using 2 pointers (saves space)
Given Only A Pointer To A Node To Be Deleted In A Singly Linked List How Do You Delete It
234
Palindrome Linked List
2-pointers
arrays
Recursion
method 2: using 2 pointers, multiple separate loops and reversing the remaining half list to compare 206
Reverse Linked List
keep the track of prev node, start with prev = None in python Copy List With Random Pointer
Remove Nth Node From End Of List
Flatten A Multilevel Doubly Linked List
Remove Duplicates From Sorted List Ii
Linked List In Zig Zag Fashion
Segregate Even And Odd Elements In A Linked List
Rearrange A Given Linked List In Place
Reverse Nodes In K Group
Merge Sort For Linked List
Flattening A Linked List
Subtract Two Numbers Represented As Linked Lists
Implement Queue Using Stacks
Backspace String Compare
Implement Stack Using Queues
Implement Stack Queue Using Deque
Stack Set 4 Evaluation Postfix Expression
Implement Two Stacks In An Array
Minimum Cost Tree From Leaf Values
Distance Of Nearest Cell Having 1 1587115620
Sum Of Subarray Minimums
Evaluate Reverse Polish Notation
Remove All Adjacent Duplicates In String Ii
Flatten Nested List Iterator
Find The Maximum Of Minimums For Every Window Size In A Given Array
Lru Cache Implementation
Diameter Of Binary Tree
Subtree Of Another Tree
Convert Sorted Array To Binary Search Tree
Maximum Depth Of Binary Tree
Lowest Common Ancestor Of A Binary Search Tree
Minimum Absolute Difference In Bst
Predecessor And Successor
Binary Tree Inorder Traversal
Check Whether Bst Contains Dead End
Binary Search Tree Iterator
Lowest Common Ancestor Of A Binary Tree
Unique Binary Search Trees Ii
All Nodes Distance K In Binary Tree
Validate Binary Search Tree
Binary Tree Right Side View
Binary Tree Level Order Traversal
Construct Binary Tree From Preorder And Postorder Traversal
Unique Binary Search Trees
Recover Binary Search Tree
Populating Next Right Pointers In Each Node
Flatten Binary Tree To Linked List
Maximum Width Of Binary Tree
Min Distance Between Two Given Nodes Of A Binary Tree
Kth Smallest Element In A Bst
Binary Tree Zigzag Level Order Traversal
Count Bst Nodes That Lie In A Given Range
Preorder To Postorder4423
Binary Tree Maximum Path Sum
Sum Of Distances In Tree
Vertical Order Traversal Of A Binary Tree
Print K Sum Paths Binary Tree
Serialize And Deserialize Binary Tree
Find Median Bst Time O1 Space
Largest Bst Binary Tree Set 2
Construct Bst From Given Preorder Traversa
Depth First Search Or Dfs For A Graph
Detect Cycle In An Undirected Graph
Detect Cycle In A Graph
Number Of Operations To Make Network Connected
Find Eventual Safe States
Strongly Connected Components Kosarajus Algo
Time Needed To Inform All Employees
Graph Coloring Applications
https://www.geeksforgeeks.org/graph-coloring-applications/#:~:text=Graph%20coloring%20problem%20is%20toare%20colored%20using%20same%20color.
Most Stones Removed With Same Row Or Column
As Far From Land As Possible
Find The City With The Smallest Number Of Neighbors At A Threshold Distance
Find Whether It Is Possible To Finish All Tasks Or Not From Given Dependencies
Prims Minimum Spanning Tree Mst Greedy Algo 5
Implementing Floyd Warshall2042
Cheapest Flights Within K Stops
Detect Negative Cycle Graph Bellman Ford
Longest Increasing Path In A Matrix
Critical Connections In A Network
Water Jug Problem Using Bfs
Travelling Salesman Problem Set 1
Total Number Spanning Trees Graph
Minimize Cash Flow Among Given Set Friends Borrowed Money
Design Add And Search Words Data Structure
Word Break Problem Trie Solution
Top K Frequent Elements
Kth Largest Element In An Array
Furthest Building You Can Reach
Kth Smallest Element In A Sorted Matrix
Find The Most Competitive Subsequence
Smallest Positive Missing Number 1587115621
Largest Subarray With 0 Sum
K Closest Points To Origin
Minimum Number Of Refueling Stops
Minimum Cost To Hire K Workers
Maximum Product Subarray
Maximum Length Of Repeated Subarray
Longest Increasing Subsequence
Longest Common Substring1452
Count Square Submatrices With All Ones
Mobile Numeric Keypad5456
Weighted Job Scheduling
Range Sum Query 2d Immutable
Optimal Binary Search Tree Dp 24
Best Time To Buy And Sell Stock Iv
Minimum Insertion Steps To Make A String Palindrome
Largest Area Rectangular Sub Matrix Equal Number 1s 0s
Minimum Cost To Merge Stones
Count Different Palindromic Subsequences
Longest Repeating Character Replacement
Maximum Number Of Visible Points
Minimum Cost For Acquiring All Coins With K Extra Coins Allowed With Every Coin
Restore The Array From Adjacent Pairs
Minimum Deletions To Make Character Frequencies Unique
Non Overlapping Intervals
Minimum Deletion Cost To Avoid Repeating Letters
Minimum Sum Two Numbers Formed Digits Array 2
M Coloring Problem 1587115620
Palindrome Partitioning
Find Maximum Number Possible By Doing At Most K Swaps
Partition Set K Subsets Equal Sum
Find Paths From Corner Cell To Middle Cell In Maze
Solving Cryptarithmetic Puzzles Backtracking 8
Print Palindromic Partitions String
Range Sum Query Immutable
Range Sum Query Mutable
Count Of Smaller Numbers After Self