Home
Summary
1.1.
Introduction
1.2.
All Leetcode Questions
1.3.
Leetcode Template
1.4.
Count Time Complexity
1.5.
Arrays and Strings
1.6.
Binary Indexed Tree
1.7.
Parentheses Summary
1.8.
Tree And Graph
1.8.1.
Build Binary Tree
1.9.
Sorting
1.10.
Search Combination
1.11.
Binary Search
1.12.
Recursion And Dynamic Programming
Array & Matrix
2.1.
Summary
2.2.
Array
2.2.1.
Subarray(子数组)
2.2.1.1.
Minimum Size Subarray Sum
2.2.1.2.
Maximum Size Subarray Sum Equals k
2.2.1.3.
Subarray Sum Equals K
2.2.1.4.
Shortest Subarray with Sum at Least K
2.2.1.5.
Longest Turbulent Subarray
2.2.1.6.
Subarray Sums Divisible by K
2.2.1.7.
Max Consecutive Ones
2.2.1.8.
Subarrays with K Different Integers(LC.992)
2.2.1.9.
Shortest Unsorted Continuous Subarray(LC.581)
2.2.1.10.
Partition Array Into Three Parts With Equal Sum(LC.1020)
2.2.2.
Sum(求和)
2.2.2.1.
Two Sum-HashTable
2.2.2.2.
Two Sum II Input Array Is Sorted
2.2.2.3.
2Sum Closest(Interview)
2.2.2.4.
3Sum
2.2.2.5.
3Sum Closest
2.2.2.6.
4Sum
2.2.3.
Duplicate(出现次数问题)
2.2.3.1.
First Missing Positive
2.2.3.2.
Find All Numbers Disappeared In An Array
2.2.3.3.
Misssing Number
2.2.3.4.
Single Element in a Sorted Array
2.2.3.5.
Single Number(unsorted)
2.2.3.6.
Single Number II
2.2.3.7.
Single Number III(LC.260)
2.2.3.8.
Majority Element
2.2.3.9.
Set Mismatch
2.2.3.10.
Find the Duplicate Number
2.2.3.11.
Find All Duplicates In An Array
2.2.3.12.
N Repeated Element in Size 2N Array
2.2.3.13.
Degree of an Array
2.2.3.14.
Remove Duplicates From Sorted Array
2.2.3.15.
Remove Duplicates From Sorted Array II
2.2.3.16.
Contains Duplicate
2.2.3.17.
Longest Consecutive Sequence
2.2.4.
Two Arrays(两个数组)
2.2.4.1.
Median of Two Sorted Arrays(LC.4)
2.2.4.2.
Intersection of two Arrays(LC.349)
2.2.4.3.
Intersection Of Two Arrays II(LC.350)
2.2.4.4.
Maximum Length of Repeated Subarray(LC.718)
2.2.4.5.
Fair Candy Swap
2.2.4.6.
Smallest Range(LC.632)
2.2.5.
Integer(数字操作)
2.2.5.1.
Reverse Integer
2.2.5.2.
Divide Two Integers
2.2.5.3.
Add to Array Form of Integer(LC.989)
2.2.5.4.
Largest Number
2.2.5.5.
Pascal Triangle
2.2.5.6.
Pascal Triangle II
2.2.5.7.
Fibonacci Number(LC.509)
2.2.6.
Array操作
2.2.6.1.
Rotate Array
2.2.6.2.
Remove Element
2.2.7.
Permutation(排列问题)
2.2.7.1.
Next Permutation
2.2.7.2.
Permutations
2.2.7.3.
Permutations II
2.2.7.4.
Letter Case Permutation
2.2.7.5.
Find the Shortest Superstring
2.2.7.6.
Number of Squareful Arrays
2.2.8.
Target Sum
2.2.9.
Guess Number Higher Or Lower
2.2.10.
Valid Mountain Array
2.2.11.
Monotonic Array
2.2.12.
Squares of a Sorted Array
2.2.13.
Array Partition I(LC.561)
2.2.14.
Partition Array into Disjoint Intervals(LC.915)
2.2.15.
Find the Celebrity(LC.277)
2.2.16.
Partition Equal Subset Sum(LC.416)
2.3.
Matrix
2.3.1.
Spiral And Flip
2.3.1.1.
Spiral Matrix
2.3.1.2.
Spiral Matrix II
2.3.1.3.
Spiral Matrix III
2.3.1.4.
Rotate Image
2.3.1.5.
Flipping an Image
2.3.1.6.
Transpose Matrix
2.3.2.
Set Matrix Zeroes(LC.73)
2.3.3.
Toeplitz Matrix(LC.766)
2.3.4.
Reshape the Matrix(LC.566)
2.3.5.
Valid Sudoku(LC.36)
2.3.6.
Sudoku Solver(LC.37)
2.3.7.
Minimum Area Rectangle II(LC.963)
2.3.8.
Search a 2D Matrix II(LC.240)
String
3.1.
String基本操作
3.1.1.
Reverse String
3.1.2.
Reverse String II
3.1.3.
Reverse Words in a String III
3.1.4.
Reverse Only Letters
3.1.5.
Reverse Vowels of a String
3.1.6.
Detect Capital
3.1.7.
Find And Replace in String(LC.833)
3.2.
重复问题
3.2.1.
Repeated Substring Pattern
3.2.2.
Find All Anagrams in a String
3.2.3.
String Compression
3.3.
回文
3.3.1.
Valid Palindrome
3.3.2.
Valid Palindrome II
3.3.3.
Palindromic Substrings
3.3.4.
Longest Palindromic Substring
3.4.
正则匹配问题
3.4.1.
Regular Expression Match
3.4.2.
Wildcard Matching
3.5.
INT-STRING转换问题
3.5.1.
To Lower Case
3.5.2.
Excel Sheet Column Title
3.5.3.
Excel Sheet Column Number
3.5.4.
Integer to Roman
3.5.5.
Roman to Integer
3.5.6.
String to Integer
3.5.7.
Count And Say
3.5.8.
String Without AAA or BBB(LC.984)
3.6.
Distance(距离问题)
3.6.1.
Edit Distance(LC.72)
3.6.2.
One Edit Distance(LC.161)
3.7.
Implement StrStr
3.8.
Add Binary
3.9.
Longest Common Prefix
3.10.
Valid Number
3.11.
Unique Email Addresses(LC.929)
3.12.
Longgest Substring Without Repeating Characters
3.13.
Number of Segments in a String
3.14.
Repeated String Match
3.15.
Count Binary Substrings
3.16.
Custom Sort String
3.17.
DI String Match
3.18.
Groups Of Special_equivalent Strings
3.19.
Buddy Strings
3.20.
Scramble String
3.21.
Length of Last Word
3.22.
Longest Word in Dictionary
3.23.
Delete Operation For Two String
3.24.
Verifying an Alien Dictionary
3.25.
Long Pressed Name
3.26.
First Unique Character In A String
3.27.
Uncommon Words from Two Sentences
3.28.
Positions of Large Groups(LC.830)
3.29.
Number of Matching Subsequences(LC.792)
3.30.
Longest Word in Dictionary through Deleting(LC.524)
3.31.
Reorder Log Files(LC.937)
3.32.
Goat Latin(LC.824)
3.33.
Minimum Window Substring(LC.76)
3.34.
Minimum Window Subsequence(LC.727)
3.35.
Backspace String Compare(LC.844)
3.36.
Partition Labels(LC.763)
3.37.
Group Anagrams(LC.49)
3.38.
Longest Uncommon Subsequence I
3.39.
Longest Uncommon Subsequence II
3.40.
Ransom Note
3.41.
Unique Morse Code Words
3.42.
Maximum Minimum Path(Interview)
3.43.
Most Common Word
Linked List
4.1.
Add Two Numbers
4.2.
Remove Duplicates From Sorted List
4.3.
Remove Duplicates From Sorted List II
4.4.
Remove Nth Node From End Of List
4.5.
Merge K Sorted Lists
4.6.
Sort List
4.7.
Swap Nodes In Pairs
4.8.
Reverse Linked List
4.9.
Reverse Linked List II
4.10.
Reverse Nodes In K Group
4.11.
Populating Next Right Pointers In Each Node II
4.12.
Intersection of Two Linked Lists
4.13.
Linked List Cycle
4.14.
Linked List Cycle II
4.15.
Palindrome Linked List
4.16.
Reorder List
4.17.
Insertion Sort List
4.18.
Minimum Index Sum of Two Lists
4.19.
Copy List With Random Pointer
4.20.
Rotate List
4.21.
Partition List
Stack & Queue
5.1.
Valid Parentheses(LC.20)
5.2.
Longest Valid Parentheses(LC.32)
5.3.
Remove Invalid Parentheses(LC.301)
5.4.
Minimum Add to Make Parentheses Valid(LC.921)
5.5.
Score Of Parentheses(LC.856)
5.6.
Validate Stack Sequences(LC.946)
5.7.
Implement Stack using Queues(LC.225)
5.8.
Min Stack(LC.155)
5.9.
Largest Rectangle in histogram(LC.84)
5.10.
Evaluate Reverse Polish Notation(LC.150)
5.11.
Number of Recent Calls(LC.933)
5.12.
Queue Reconstruction by Height(LC.406)
5.13.
Shortest Subarray with Sum at Least K(LC.862)
5.14.
Design Circular Queue(LC.622)
5.15.
Design Circular Deque(Lc.641)
Tree, Tries & Graph
6.1.
Tree Summary
6.2.
Traversal
6.2.1.
Preorder Traversal
6.2.2.
Inorder Traversal
6.2.3.
Postorder Travesal
6.2.4.
Level Order Traversal
6.2.5.
Level Order Traversal II
6.2.6.
Zigzag Level Order Traversal
6.2.7.
Vertical Order Traversal
6.2.8.
N ary Tree Preorder Traversal
6.2.9.
N ary Tree Postorder Traversal
6.2.10.
N ary Tree Level Order Traversal
6.3.
Build Binary Tree
6.3.1.
Construct Binary Tree From Preorder and Inorder Traversal
6.3.2.
Construct Binary Tree From Inorder And Postorder Traversal
6.3.3.
Convert Sorted Array To Binary Search Tree
6.3.4.
Convert Sorted List to Binary Search Tree
6.3.5.
Invert Binary Tree
6.3.6.
Merge Two Binary Trees
6.3.7.
Univalued Binary Tree
6.3.8.
Convert BST to Greater Tree
6.3.9.
Serialize and Deserialize BST
6.4.
Tree Quality
6.4.1.
Minimum Depth of Binary Tree
6.4.2.
Maximum Depth of Binary Tree
6.4.3.
Maximum Depth of N ary Tree
6.4.4.
Balanced Binary tree
6.4.5.
Flatten Binary Tree To Linked List
6.4.6.
Populating Next Right Pointers In Each Node
6.4.7.
Longest Univalue Path
6.4.8.
Same Tree
6.4.9.
Symmetrix Tree
6.4.10.
Binary Search Tree Iterator
6.4.11.
Binary Tree Paths
6.4.12.
Count Complete Tree Nodes
6.4.13.
Binary Tree Right Side View
6.4.14.
Average of Levels in Binary Tree
6.4.15.
Construct String from Binary Tree
6.4.16.
Diameter of Binary Tree
6.4.17.
Second Minimum Node In a Binary Tree
6.4.18.
Subtree of Another Tree
6.4.19.
Sum of Left Leaves
6.4.20.
Find Bottom Left Tree Value
6.4.21.
Find Largest Value in Each Tree Row
6.4.22.
Flip Equivalent Binary Trees
6.4.23.
Binary Tree Tilt
6.4.24.
Check Completeness of a Binary Tree(LC.958)
6.5.
Binary Search Tree
6.5.1.
Validate BST
6.5.2.
Unique BST
6.5.3.
Unique BST II
6.5.4.
Recover BST
6.5.5.
Convert Sorted Array To BST
6.5.6.
Convert Sorted List to BST
6.5.7.
Convert BST to Sorted Doubly Linked List
6.5.8.
Kth Smallest Element in a BST
6.5.9.
Lowest Common Ancestor of a BST
6.5.10.
Lowest Common Ancestor of a Binary Tree
6.5.11.
Delete Node in a BST
6.5.12.
Find Mode in BST
6.5.13.
Trim a BST
6.5.14.
Increasing Order Search Tree
6.5.15.
Distribute Coins in Binary Tree
6.6.
Sum
6.6.1.
Path Sum(LC.112)
6.6.2.
Path Sum II(LC.113)
6.6.3.
Path Sum III(LC.437)
6.6.4.
Sum Root to Leaf Numbers(LC.129)
6.6.5.
Smallest String Starting From Leaf(LC.988)
6.6.6.
Binary Tree Maximum Path Sum(LC.124)
6.7.
Subtree: Maximum Average Node(Interview)
6.8.
Cousins in Binary Tree(LC.933)
6.9.
Smallest Subtree with all the Deepest Nodes(LC.865)
6.10.
Friend Circles(LC.547)
Graph
7.1.
Clone Graph
Math
8.1.
Palindrome Number
8.2.
Powerx n
8.3.
Permutation Sequence
8.4.
Gray Code
8.5.
Powerful Integers
8.6.
Surface Area of 3D Shapes
8.7.
Largest Time for Given Digits
8.8.
X of a Kind in a Deck of Cards
8.9.
Smallest Range I
8.10.
Factorial Trailing Zeroes
8.11.
Plus One
8.12.
Largest Perimeter Triangle
Bit-Manipulation
9.1.
Summary
9.2.
Hamming Distance
9.3.
Letter Case Permutation
9.4.
Find the Difference
9.5.
Reverse Bits
9.6.
Power of Two
9.7.
Power of Four
9.8.
Binary Number with Alternating Bits
9.9.
Number Complement
9.10.
Sum of Two Integers
9.11.
Maximum Product of Word Lengths
9.12.
Counting Bits
9.13.
Add Two Numbers II
Sorting and Searching
10.1.
Summary
10.2.
Top K Frequent Elements
10.3.
Bubble Sort
10.3.1.
Sort Characters By Frequency
10.3.2.
Kth Largest Element in an Array
10.3.3.
Merge Sorted Array
10.4.
Merge Two Sorted Lists
10.5.
H Index
10.6.
H Index II
10.7.
Valid Anagram
10.8.
Sort Array By Parity
10.9.
Sort Array By Parity II
10.10.
Move Zeroes
10.11.
Jewels and Stones
10.12.
Sort Colors
10.13.
Pancake Sorting
10.14.
Reorganize String
10.15.
Maximum Gap
10.16.
Wiggle Sort II
10.17.
Random Pick with Blacklist
10.18.
Interval
10.18.1.
Insert Interval
10.18.2.
Merge Intervals
10.18.3.
Interval List Intersections
Binary Search
11.1.
Summary
11.2.
Upper Bound
11.2.1.
Find First And Last Position Of Element In Sorted Array(LC.34)
11.2.2.
Search Insert Position(LC.35)
11.2.3.
Find Smallest Letter Greater Than Target
11.2.4.
Relative Ranks
11.2.5.
Binary Search(LC.704)
11.2.6.
Time Based Key Value Store(LC.981)
11.2.7.
Sqrt x 3(LC.69)
11.3.
Rotated & Peak
11.3.1.
Search In Rotated Sorted Array(LC.33)
11.3.2.
Search In Rotated Sorted Array II(LC.81)
11.3.3.
Find Minimum in Rotated Sorted Array(LC.153))
11.3.4.
Find Minimum in Rotated Sorted Array II(LC.154)
11.3.5.
Find Peak Element(LC.162)
11.3.6.
Peak Index in a Mountain Array(LC.852)
11.4.
Matrix
11.4.1.
Search a 2D Matrix
11.5.
kth & Matrix
11.5.1.
Kth Smallest Element in a Sorted Matrix(LC.378)
11.5.2.
Kth Smallest Number in Multiplication Table(LC.668)
11.6.
kth & Two Points
11.6.1.
Find K th Smallest Pair Distance
11.6.2.
K th Smallest Prime Fraction
11.7.
Guess and Check
11.7.1.
Swim in Rising Water(LC.778)
11.7.2.
Koko Eating Bananas(LC.875)
11.7.3.
Preimage Size of Factorial Zeroes Function
11.7.4.
Dungeon Game(LC.175)
11.8.
Online Election
11.9.
First Bad Version
Backtracking, DFS, BFS
12.1.
Combination(Backtracking)
12.1.1.
Letter Combinations of a Phone Number(LC.17)
12.1.2.
Combinations(LC.77)
12.1.3.
Combination Sum(LC.39)
12.1.4.
Combination Sum II(LC.40)
12.1.5.
Combination Sum III(LC.216)
12.1.6.
Subsets(LC.78)
12.1.7.
Subset II(LC.90)
12.2.
Permutation(BackTracking)
12.2.1.
Permutations
12.2.2.
Permutations II
12.2.3.
Next Permutation
12.2.4.
Letter Case Permutation
12.2.5.
Find the Shortest Superstring
12.2.6.
Number of Squareful Arrays
12.3.
DFS
12.3.1.
Generate Parentheses
12.3.2.
Remove Invalid Parentheses(LC.301)
12.3.3.
Sudoku Solver(LC.37)
12.3.4.
Word Search(LC.79
12.3.5.
Word Search II(LC.212)
12.4.
BFS
12.5.
Palindrome Partitioning
12.6.
Palindrome Partitioning II
12.7.
Restore IP Addresses
12.8.
Unique Paths
12.9.
Unique Paths II
12.10.
Unique Paths III
12.11.
Number of Islands(LC.200)
12.12.
Robot Room Cleaner(LC.489)
Greed
13.1.
Jump Game
13.2.
Jump Game II
13.3.
Best Time to Buy and Sell Stock
13.4.
Best Time To Buy and Sell Stock II
13.5.
Best Time To buy and sell Stock III
13.6.
Container With Most Water
13.7.
Gas Station
DP
14.1.
Edit Distance(LC.72)
14.2.
Delete Operation for Two Strings(LC.583)
14.3.
Minimum ASCII Delete Sum for Two Strings(LC.712)
14.4.
Triangle
14.5.
Maximum Subarray
14.6.
Maximal Rectangle
14.7.
House Robber
14.8.
Word Break
14.9.
Interleaving String
14.10.
Decode Ways
14.11.
Distinct Subsequences
14.12.
Can I Win
14.13.
Trapping Rain Water
14.14.
Dungeon Game
14.15.
Longest Increasing Subsequence
14.16.
Range Sum Query Immutable
14.17.
Burst Balloons
14.18.
Different Ways to Add Parentheses
14.19.
Least Operators to Express Number
14.20.
House Robber III
14.21.
Min Cost Climbing Stairs
14.22.
Longest Continuous Increasing Subsequence
14.23.
Minimum Path Sum
14.24.
Climbing Stairs
14.25.
Count Numbers with Unique Digits
14.26.
Numbers With Same Consecutive Differences
Divide-And-Conquer
15.1.
Merge K Sorted Lists
15.2.
Burst Balloons
15.3.
K Closest Points to Origin
Recursion
16.1.
Number of Atoms
Design
17.1.
Task Scheduler
17.2.
My Calendar I
17.3.
Student Attendance Record I
17.4.
Find Duplicate File in System
17.5.
Parse Lisp Expression
17.6.
LRU Cache
17.7.
Random Pick with Blacklist
Others
18.1.
Mini Parser
18.2.
Complex Number Multiplication
18.3.
Minimum Time Difference
18.4.
Optimal Division
18.5.
Permutation in String
18.6.
Robot Return To Origin
18.7.
Number of Longest Increasing Subsequence
18.8.
1 bit and 2 bit characters
18.9.
Find Pivot Index
18.10.
Largest Number At Least Twice Of Others
18.11.
Rotated Digits
18.12.
Find And Replace Pattern
New Problems
19.1.
Leetcode 739. Daily Temperatures
19.2.
Leetcode 503. Next Greater Element II
19.3.
Leetcode 636. Exclusive Time of Functions
19.4.
Leetcode 975. Odd Even Jump
19.5.
Leetcode 985. Sum of Even Numbers After Queries
19.6.
Leetcode 682. Baseball Game
19.7.
Leetcode 791. Custom Sort String
19.8.
Leetcode 937. Reorder Log Files
19.9.
Leetcode 761. Special Binary String
19.10.
Leetcode 990. Satisfiability of Equality Equations
19.11.
Leetcode 962. Maximum Width Ramp
19.12.
Leetcode 957. Prison Cells After N Days
19.13.
Leetcode 994. Rotting Oranges
19.14.
Leetcode 689. Maximum Sum of 3 Non Overlapping Subarrays
19.15.
Hightest Five(Interview)
19.16.
K Nearest Points(Interview)
19.17.
City Connection(Interview)
19.18.
Leetcode 1005. Maximize Sum Of Array After K Negations
19.19.
Leetcode 1006. Clumsy Factorial
19.20.
Leetcode 737. Sentence Similarity II
19.21.
Leetcode 734. Sentence Similarity
19.22.
Leetcode 684. Redundant Connection
19.23.
Leetcode 695. Max Area of Island
19.24.
Leetcode 841. Keys and Rooms
19.25.
Leetcode 1012. Complement of Base 10 Integer
19.26.
Leetcode 1013. Pairs of Songs With Total Durations Divisible by 60
19.27.
Leetcode 1014. Capacity To Ship Packages Within D Days
19.28.
Leetcode 307. Range Sum Query Mutable
19.29.
Leetcode 315. Count of Smaller Numbers After Self
19.30.
Leetcode 213. House Robber II
19.31.
Leetcode 1021. Best Sightseeing Pair
19.32.
Leetcode 1022. Smallest Integer Divisible by K
19.33.
Leetcode 253. Meeting Rooms II
19.34.
Leetcode 252. Meeting Rooms(LC.252)
Published with GitBook
Summary
Array & String Summary
Array & String Summary
results matching "
"
No results matching "
"