leetcode 的题目,思路,代码。
- 0070.
[E]
.Climbing Stairs(dp
) - 0053.
[E]
.Maximum Subarray(dp
,array
) - 0121.
[E]
.Best Time to Buy and Sell Stock(dp
,array
) - 0764.
[E]
.Min Cost Climbing Stairs(dp
,array
) - 0198.
[E]
.House Robber(dp
,array
) - 0091.
[M]
.Decode Ways(dp
) - 0523.
[M]
.Continuous Subarray Sum(dp
) - 1191.
[M]
.K-Concatenation Maximum Sum(dp
,array
) - 0837.
[M]
.New 21 Game(dp
,math
) - 0467.
[M]
.Unique Substrings in Wraparound String(dp
,string
) - 0674.
[M]
.Longest Continuous Increasing Subsequence(dp
) - 0673.
[M]
.Number of Longest Increasing Subsequence(dp
) - 0010.
[H]
.Regular Expression Matching(dp
) - 0062.
[M]
.Unique Paths(dp
) - 0279.
[M]
.Perfect Squares(dp
) - 0300.
[M]
.Longest Increasing Subsequence(dp
) - 0139.
[M]
.Word Break(dp
) - 0140.
[H]
.Word Break II(dp
,backtrack
) - 0322.
[M]
.Coin Change(dp
) - 0152.
[M]
.Maximum Product Subarray(dp
) - 0064.
[M]
.Minimum Path Sum(dp
) - 0072.
[H]
.Edit Distance(dp
) - 0279.
[M]
.Perfect Squares(dp
,bfs
,backtrack
) - 0647.
[M]
.Palindromic Substrings(dp
) - 0096.
[M]
.Unique Binary Search Trees(dp
,tree
) - 0664.
[H]
.Strange Printer(dp
) - 0309.
[M]
.Best Time to Buy and Sell Stock with Cooldown(dp
) - 1186.
[M]
.Maximum Subarray Sum with One Deletion(dp
) - 0085.
[H]
.Maximal Rectangle(dp
) - 0123.
[H]
.Best Time to Buy and Sell Stock III(dp
) - 2439.
[M]
.Minimize Maximum of Array(dp
,prefix sum
,greedy
) - 0509.
[E]
.Fibonacci Number(dp
) - 0518.
[M]
.Coin Change II(dp
) - 0376.
[M]
.Wiggle Subsequence(dp
,greedy
) - 0486.
[M]
.Predict the Winner(dp
,array
) - 0650.
[M]
.2 Keys Keyboard(dp
,array
) - 0712.
[M]
.Minimum ASCII Delete Sum for Two Strings(dp
,array
) - 0714.
[M]
.Best Time to Buy and Sell Stock with Transaction Fee(dp
,array
) - 0718.
[M]
.Maximum Length of Repeated Subarray(dp
,array
) - 0740.
[M]
.Delete and Earn(dp
,array
) - 0769.
[M]
.Max Chunks To Make Sorted(dp
,array
) - 0826.
[M]
.Most Profit Assigning Work(dp
,array
) - 0923.
[M]
.3Sum With Multiplicity(dp
,array
) - 0967.
[M]
.Numbers With Same Consecutive Differences(dp
,array
) - 1024.
[M]
.Video Stitching(dp
,greedy
) - 1053.
[M]
.Previous Permutation With One Swap(dp
,array
) - 1081.
[M]
.Smallest Subsequence of Distinct Characters(dp
,array
) - 0174.
[H]
.Dungeon Game(dp
,array
) - 0188.
[H]
.Best Time to Buy and Sell Stock IV(dp
,array
)
- 001.
[E]
.Two Sum(array
,map
) - 461.
[E]
.Hamming Distance(bitset
) - 728.
[E]
.Self Dividing Number(vector
) - 657.
[E]
.Judge Route Circle(string
) - 617.
[E]
.Merge Two Biany Trees(tree
) - 002.
[M]
.Add Two Numbers(list
) - 003.
[M]
.Longest Substring Without Repeating Characters(array
) - 004.
[H]
.Median of Two Sorted Arrays(vector
) - 005.
[M]
.Longest Palindromic Substring(vector,string
) - 007.
[E]
.Reverse Integer(int,long
) - 011.
[M]
.Container With Most Water(vector
) - 013.
[E]
.Roman to Integer(map
) - 014.
[E]
.Longest Common Prefix(vector,string
) - 015.
[M]
.3Sum(vector
) - 017.
[M]
.Letter Combinations of a Phone Number(vector,string
) - 019.
[M]
.Remove Nth Node From End of List(list
) - 020.
[E]
.Valid Parentheses(vector
) - 021.
[E]
.Merge Two Sorted Lists(list
) - 022.
[M]
.Generate Parentheses(recursion
) - 026.
[E]
.Remove Duplicates from Sorted Array(vector
) - 033.
[M]
.Search in Rotated Sorted Array(bisearch
) - 034.
[M]
.Search for a Range(bisearch
) - 023.
[H]
.Merge k Sorted Lists(list,quick sort
) - 041.
[H]
.First Missing Positive(vector
) - 042.
[H]
.Trapping Rain Water(vector
) - 036.
[M]
.Valid Sudoku(two-dimensional array
) - 048.
[M]
.Rotate Image(two-dimensional array,matrix
) - 049.
[M]
.Group Anagrams(hash,unordered_map
) - 050.
[M]
.Pow(x,n)(math
) - 054.
[M]
.Spiral Matrix(array
) - 055.
[M]
.Jump Game(greedy,array
) - 056.
[M]
.Merge Intervals(sort,array
) - 066.
[E]
.Plus One(math,array
) - 075.
[M]
.Sort Colors(sort,array,two pointer
) - 076.
[H]
.Minimum Window Substring(array,two pointer,hash
) - 078.
[M]
.Subsets(array
) - 079.
[M]
.Word Search(Backtracking
) - 094.
[M]
.Binary Tree Inorder Traversal(tree
) - 098.
[M]
.Validate Binary Search Tree(tree,DFS
) - 102.
[M]
.Binary Tree Level Order Traversal(tree,BFS
) - 103.
[M]
.Binary Tree Zigzag Level Order Traversal(tree,BFS
) - 105.
[M]
.Construct Binary Tree from Preorder and Inorder Traversal(array,tree,DFS
) - 108.
[E]
.Convert Sorted Array to Binary Search Tree(array,tree,BFS
) - 118.
[E]
.Pascal's Triangle(array
) - 122.
[E]
.Best Time to Buy and Sell Stock II(array
) - 088.
[E]
.Merge Sorted Array(array,two pointers
) - 128.
[H]
.Longest Consecutive Sequence(array
) - 134.
[M]
.Gas Station(Greedy
) - 125.
[E]
.Valid Palindrome(string,two pointers
) - 127.
[M]
.Word Ladder(BFS
) - 073.
[M]
.Set Matrix Zeroes(array
) - 130.
[M]
.Surrounded Regions(dfs,bfs,union find
) - 191.
[E]
.Number of 1 Bits(Bit Manipulation
) - 084.
[H]
.Largest Rectangle in Histogram(array,stack
) - 150.
[M]
.Evaluate Reverse Polish Notation(stack
) - 138.
[M]
.Copy List with Random Pointer(Linked List,Hash Table
) - 148.
[M]
.Sort List(Linked List,Sort
) - 200.
[M]
.Number of Islands(dfs,bfs
) - 207.
[M]
.Course Schedule(dfs,bfs,graph,topological sort
) - 169.
[E]
.Majority Element(array
) - 067.
[E]
.Add Binary(math,string
) - 215.
[M]
.Kth Largest Element in an Array(divide and conquer,heap
) - 217.
[E]
.Contains Duplicate(array,hash table
) - 162.
[M]
.Find Peak Element(array
) - 141.
[E]
.Linked List Cycle(LinkList two pointers
) - 344.
[E]
.Reverse String(string
) - 227.
[M]
.Basic Calculator II(string
) - 230.
[M]
.Kth Smallest Element in a BST(tree
) - 234.
[E]
.Palindrome Linked List(array
) - 236.
[M]
.Lowest Common Ancestor of a Binary Tree(tree
) - 238.
[M]
.Product of Array Except Self(array
) - 239.
[H]
.Sliding Window Maximum(array,deque
) - 240.
[M]
.Search a 2D Matrix II(array
) - 289.
[M]
.Game of Life(array
) - 142.
[M]
.Linked List Cycle II(list,tow pointers
) - 395.
[M]
.Longest Substring with At Least K Repeating Characters(string,recursion
) - 210.
[M]
.Course Schedule II(topological,graph
) - 179.
[M]
.Largest Number(sort
) - 057.
[H]
.Insert Interval(sort,array
) - 059.
[H]
.Spiral Matrix II(array
) - 392.
[E]
.Is Subsequence(string
,greedy
) - 153.
[M]
.Find Minimum in Rotated Sorted Array(array
,binary search
) - 154.
[H]
.Find Minimum in Rotated Sorted Array II(array
,binary search
) - 209.
[M]
.Minimum Size Subarray Sum(array
) - 228.
[M]
.Summary Ranges(array
) - 043.
[M]
.Multiply Strings(array
,string
) - 414.
[E]
.Third Maximum Number(array
) - 416.
[M]
.Partition Equal Subset Sum(array
,backtrack
) - 039.
[M]
.Combination Sum(array
,backtrack
) - 040.
[M]
.Combination Sum II(array
,backtrack
) - 046.
[M]
.Permutations(backtrack
) - 047.
[M]
.Permutations II(backtrack
) - 136.
[E]
.Single Number(bit manipulation
) - 137.
[M]
.Single Number II(bit manipulation
) - 260.
[M]
.Single Number III(bit manipulation
) - 299.
[M]
.Bulls and Cows(hash table
) - 187.
[M]
.Repeated DNA Sequences(hash table
,bit manipulation
) - 083.
[E]
.Remove Duplicates from Sorted List(linkedlist
) - 082.
[M]
.Remove Duplicates from Sorted List II(linkedlist
) - 160.
[E]
.Intersection of Two Linked Lists(linkedlist
) - 304.
[M]
.Range Sum Query 2D - Immutable(array
) - 713.
[M]
.Subarray Product Less Than K(array
,two pointers
) - 845.
[M]
.Longest Mountain in Array(two pointers
) - 377.
[M]
.House Robber III(dfs
,tree
) - 621.
[M]
.Task Scheduler(greedy
,array
) - 954.
[M]
.Array of Doubled Pairs(hash table
) - 494.
[M]
.Target Sum(dfs
) - 143.
[M]
.Reorder List(linkedlist
) - 464.
[M]
.Can I Win(dfs
) - 1160.
[E]
.Find Words That Can Be Formed by Characters(hash table
) - 1161.
[M]
.Maximum Level Sum of a Binary Tree(tree
) - 1162.
[M]
.As Far from Land as Possible(bfs
) - 1163.
[H]
.Last Substring in Lexicographical Order(substring
) - 1169.
[E]
.Invalid Transactions(array
,string
) - 1170.
[E]
.Compare Strings by Frequency of the Smallest Character(array
,string
) - 1171.
[M]
.Remove Zero Sum Consecutive Nodes from Linked List(linkedlist
) - 1177.
[M]
.Can Make Palindrome from Substring(string
,array
) - 1175.
[E]
.Prime Arrangements(math
) - 0009.
[E]
.Palindrome Number(math
) - 0146.
[M]
.LRU Cache(Design
) - 0328.
[M]
.Odd Even Linked List(list
) - 0567.
[M]
.Permutation in String(two pointers
) - 0151.
[M]
.Reverse Words in a String(string
) - 0836.
[E]
.Rectangle Overlap(array
)
- 100.
[E]
.Same Tree(tree
) - 111.
[E]
.Minimum Depth of Binary Tree(tree
) - 110.
[E]
.Balanced Binary Tree(tree
) - 112.
[E]
.Path Sum(tree
) - 0101.
[E]
.Symmetric Tree(tree
,DFS
) - 0104.
[E]
.Maximum Depth of Binary Tree(tree,DFS
) - 0559.
[E]
.Maximum Depth of N-ary Tree(tree
,DFS
) - 112.
[M]
.Path Sum II(tree
) - 114.
[M]
.Flatten Binary Tree to Linked List(tree
) - 0116.
[M]
.Populating Next Right Pointers in Each Node(tree
,BFS
) - 0117.
[M]
.Populating Next Right Pointers in Each Node II(tree
,BFS
) - 0129.
[M]
.Sum Root to Leaf Numbers(tree
,DFS
) - 0687.
[M]
.Longest Univalue Path(tree
,DFS
)
- 2476.
[M]
.Closest Nodes Queries in a Binary Search Tree(tree
,DFS
,binary search
)
- 0206.
[E]
.Reverse Linked List(Linked List
) - 0092.
[M]
.Reverse Linked List II(list
)
- 2536.
[M]
.Increment Submatrices by One(array
,matrix
,prefix sum
)
- 2537.
[M]
.Count the Number of Good Subarrays(array
,hash table
,sliding window
)
- 0638.
[M]
.Shopping Offers(depth-first-search
) - 0934.
[M]
.Shortest Bridge(bfs
) - 1020.
[M]
.Number of Enclaves(dfs
) - 1029.
[M]
.Shortest Path with Alternating Colors(graph
,dfs
)
- 0131.
[M]
.Palindrome Partitioning(Backtracking
) - 0567.
[M]
.Beautiful Arrangement(array
,backtracking
) - 0698.
[M]
.Partition to K Equal Sum Subsets(array
,backtracking
) - 0093.
[M]
.Restore IP Addresses(string
,backtracking
) - 0996.
[H]
.Number of Squareful Arrays(array
,backtracking
) - 0301.
[H]
.Remove Invalid Parentheses(string
,backtracking
) - 0282.
[H]
.Expression Add Operators(string
,backtracking
)