Table of Contents
- 01 Arrays
- 01a01 Two Sum
- 01a01a Three Sum
- 01a03 Duplicate Number
- 01a06 Rotate Array
- 01c Sorting
- 01c01 Quick Sort
- 02 Strings
- 02b Longest Common Prefix
- 02c Group Anagrams
- 02d Edit Distances
- 02g Parentheses matching
- 02g01a Longest Valid Parentheses
- 02g01b Valid Parenthesis String
- 02h01 Reorganize String
- [ string ]
- 14 Subarray
- 14a Maximum Subarray Sum
- 14b Best Time to Buy and Sell Stock
- [ greedy ]
- 14b01 Best Time to Buy and Sell Stock II
- [ greedy ]
- 14b02 Best Time to Buy and Sell Stock IV
- 14c Continuous Subarray Sum
- 14d Subarray Sum Equals K
- 14e Product of Array Except Self
- 14f Maximize Subarray Sum After Removing All Occurrences of One Element
- 16 Stack
- 16a Asteroid Collision
- [ stack ]
- 18 Linked List
- 18a Reverse Linked List
- [ linked list ]
- 18b Remove Nth Node From End of List
- 18c Merging Two Sorted Linked Lists
- 18e Merge K Sorted Lists
- 18f Detecting a Cycle in Linked List
- 18g Implementing LRU Cache
- 20 Sequences
- 20a Longest Consecutive Sequence
- 20b Longest Increasing Subsequence
- 20b01 Russian Doll
- 20c Longest Common Subsequence
- 20d Longest Palindromic Subsequence
- 20e Sum of Good Subsequences
- 20e02 Distinct Subsequences
- 22 Palindromes
- 22a Longest Palindromic Substring
- [ palindromes ]
- 22b Count Palindromic Substrings
- [ palindromes ]
- 22c Manacher Algorithm
- [ palindromes ]
- 22d Palindromic Partition
- [ palindromes ]
- 25 Two Pointers
- 25a Containers with Most Water
- [ two pointers ]
- 27 Sliding Window
- 27a Longest Substring Without Repeating Characters
- [ two pointers | sliding window ]
- 27b String Compression
- [ two pointers | sliding window ]
- 27c Take K of Each Character From Left and Right
- [ sliding window ]
- 27d Partition Labels
- [ sliding window ]
- 30 Trees
- 30a Tree Traversals
- 30a01 In Order
- 30a02 Pre Order
- 30a03 Post Order
- 30a04 Level Order
- 30a05 Binary Tree from its Traversals
- 30b Binary Tree Maximum Path Sum
- 30c Lowest Common Ancestor
- 30c01 In a Binary Tree
- 30c02 In a Binary Search Tree
- 30d Segment Trees
- 30e01 Check Completeness of a Binary Tree
- [ binary tree ]
- 32 Heap
- 32a Median in a Stream
- [ heap ]
- 35 BFS
- 35a Shortest Path in Binary Matrix
- [ bfs ]
- 35b 01 Matrix
- [ bfs ]
- 35c All Nodes Distance K in Binary Tree
- [ binary tree | bfs ]
- 37 DFS
- 37c Reconstruct Itinerary
- [ eulerian path | dfs ]
- 40 Single Source Shortest Path
- 40a Dijkstra Algorithm
- [ dijkstra sssp ]
- 40a01 Cheapest Flights Within K Stops
- [ dijkstra sssp | bfs ]
- 40b Bellman-Ford Algorithm
- 42 Minimum Spanning Tree
- 42a Kruskals algorithm
- [ mst ]
- 42a01 Min Cost to Connect All Points
- [ mst ]
- 42b Prims Algorithm
- [ mst ]
- 44 Topological Sort
- [ topological sort ]
- 44a Find Eventual Safe States
- [ topological sort ]
- 46 Max Flow Min Cut
- 50 Intervals
- 50a Merge Intervals
- [ intervals ]
- 50b Insert Interval
- [ intervals ]
- 50c Min Meeting Rooms
- [ intervals | greedy ]
- 50d Line Sweep Technique
- [ line sweep ]
- 50d01 Zero Array Transformation I
- [ line sweep ]
- 50d02 Zero Array Transformation II
- [ line sweep | binary search ]
- 50d03 Smallest Range Covering Elements from K Lists
- [ line sweep | intervals ]
- 50e Minimum Number of Arrows to Burst Balloons
- [ intervals | greedy ]
- 60 Monotonic Stack
- [ monotonic stack ]
- 60a Largest Rectangle in Histogram
- [ monotonic stack ]
- 60b Sum of Subarray Minimums
- [ monotonic stack ]
- 60c Daily Temperatures
- [ monotonic stack ]
- 70 Permutations
- 70a Next Permutation
- [ permutation ]
- 70b Permutation Sequence
- [ permutation ]
- 72 Sets
- 72a Constructing Powersets
- 72c DSU with Rollbacks
- 73 DSU Union-Find
- 73a Number of Connected Components in an Undirected Graph
- [ dsu ]
- 73b The Earliest Moment When Everyone Become Friends
- 73c Making A Large Island
- 75 Binary Search
- 75a Binary Search in Array
- 75a01 Binary Search in Sorted Array
- [ binary search ]
- 75a02 First and Last Position in a Sorted Array
- [ binary search ]
- 75a03 Find Minimum in Rotated Sorted Array
- [ binary search ]
- 75a04 Find Peak Element
- 75b Minimum Limit of Balls in a Bag
- [ binary search ]
- 75d Split Array Largest Sum
- [ binary search ]
- 75e Swim in Rising Water
- [ binary search | bfs ]
- 84 Greedy Approach
- 84a01 Gas Station
- [ greedy ]
- 84a02 Max Chunks To Make Sorted
- [ greedy ]
- 84a03 Jump Game
- [ greedy ]
- 84a03a Jump Game II
- [ greedy ]
- 84a03b Jump Game III
- [ bfs ]
- 84a04 Maximum Swap
- 85 Backtracking
- 85a N-Queens Problem
- 85b Sudoku Solver
- 87 Knapsack
- 87a Bounded Knapsack
- 87b Unbounded Knapsack
- 87c Fractional Knapsack
- 87d Subsetsum to knapsack
- 87e Coin Change
- 87e01 Coin Change
- [ knapsack ]
- 87e02 Coin Change II
- [ knapsack ]
- 90 Range Queries
- 90a01 Range Frequency Queries
- 99a01 Rotate Image
- 99a02 Word break
- [ trie | dynamic programming ]