您的位置:首页 > 职场人生

leetcode面试频率及总结

2015-11-23 10:16 316 查看


1Two Sum25arraysort
setTwo Pointers
2Add Two Numbers34linked listTwo Pointers
Math
3Longest Substring Without Repeating Characters32stringTwo Pointers
hashtable
4Median of Two Sorted Arrays53arrayBinary Search
5Longest Palindromic Substring42string
6ZigZag Conversion31string
7Reverse Integer23Math
8String to Integer (atoi)25stringMath
9Palindrome Number22Math
10Regular Expression Matching53stringRecursion
DP
11Container With Most Water32arrayTwo Pointers
12Integer to Roman34Math
13Roman to Integer24Math
14Longest Common Prefix21string
153Sum35arrayTwo Pointers
163Sum Closest31arrayTwo Pointers
17Letter Combinations of a Phone Number33stringDFS
184Sum32array
19Remove Nth Node From End of List23linked listTwo Pointers
20Valid Parentheses25stringStack
21Merge Two Sorted Lists25linked listsort
Two Pointers
merge
22Generate Parentheses34stringDFS
23Merge k Sorted Lists34linked listsort
heapTwo Pointers
merge
24Swap Nodes in Pairs24linked list
25Reverse Nodes in k-Group42linked listRecursion
Two Pointers
26Remove Duplicates from Sorted Array13arrayTwo Pointers
27Remove Element14arrayTwo Pointers
28Implement strStr()45stringTwo Pointers
KMP
rolling hash
29Divide Two Integers43Binary Search
Math
30Substring with Concatenation of All Words31stringTwo Pointers
31Next Permutation52arraypermutation
32Longest Valid Parentheses41stringDP
33Search in Rotated Sorted Array43arrayBinary Search
34Search for a Range43arrayBinary Search
35Search Insert Position22array
36Valid Sudoku22array
37Sudoku Solver42arrayDFS
38Count and Say22stringTwo Pointers
39Combination Sum33arraycombination
40Combination Sum II42arraycombination
41First Missing Positive52arraysort
42Trapping Rain Water42arrayTwo Pointers
Stack
43Multiply Strings43stringTwo Pointers
Math
44Wildcard Matching53stringRecursion
DP
greedy
45Jump Game II42array
46Permutations34arraypermutation
47Permutations II42arraypermutation
48Rotate Image42array
49Anagrams34string
hashtable
50Pow(x, n)35Binary Search
Math
51N-Queens43arrayDFS
52N-Queens II43arrayDFS
53Maximum Subarray33arrayDP
54Spiral Matrix42array
55Jump Game32array
56Merge Intervals45arraysort
linked listmerge
red-black tree
57Insert Interval45arraysort
linked listmerge
red-black tree
58Length of Last Word11string
59Spiral Matrix II32array
60Permutation Sequence51permutation
Math
61Rotate List32linked listTwo Pointers
62Unique Paths23arrayDP
63Unique Paths II33arrayDP
64Minimum Path Sum33arrayDP
65Valid Number25stringMath
66Plus One12arrayMath
67Add Binary24stringTwo Pointers
Math
68Text Justification42string
69Sqrt(x)44Binary Search
70Climbing Stairs25DP
71Simplify Path31stringStack
72Edit Distance43stringDP
73Set Matrix Zeroes35array
74Search a 2D Matrix33arrayBinary Search
75Sort Colors42arraysort
Two Pointers
76Minimum Window Substring42stringTwo Pointers
77Combinations34combination
78Subsets34arrayRecursion
combination
79Word Search34arrayDFS
80Remove Duplicates from Sorted Array II22arrayTwo Pointers
81Search in Rotated Sorted Array II53arrayBinary Search
82Remove Duplicates from Sorted List II33linked listRecursion
Two Pointers
83Remove Duplicates from Sorted List13linked list
84Largest Rectangle in Histogram52arrayStack
85Maximal Rectangle51arrayDP
Stack
86Partition List33linked listTwo Pointers
87Scramble String52stringRecursion
DP
88Merge Sorted Array25arrayTwo Pointers
merge
89Gray Code42combination
90Subsets II42arrayRecursion
combination
91Decode Ways34stringRecursion
DP
92Reverse Linked List II32linked listTwo Pointers
93Restore IP Addresses33stringDFS
94Binary Tree Inorder Traversal43treeRecursion
hashtablemorris
Stack
95Unique Binary Search Trees II41treeDP
DFS
96Unique Binary Search Trees31treeDP
97Interleaving String52stringRecursion
DP
98Validate Binary Search Tree35treeDFS
99Recover Binary Search Tree42treeDFS
100Same Tree11treeDFS
101Symmetric Tree12treeDFS
102Binary Tree Level Order Traversal34treeBFS
103Binary Tree Zigzag Level Order Traversal43queueBFS
treeStack
104Maximum Depth of Binary Tree11treeDFS
105Construct Binary Tree from Preorder and Inorder Tr33arrayDFS
tree
106Construct Binary Tree from Inorder and Postorder T33arrayDFS
tree
107Binary Tree Level Order Traversal II31treeBFS
108Convert Sorted Array to Binary Search Tree23treeDFS
109Convert Sorted List to Binary Search Tree43linked listRecursion
Two Pointers
110Balanced Binary Tree12treeDFS
111Minimum Depth of Binary Tree11treeDFS
112Path Sum13treeDFS
113Path Sum II22treeDFS
114Flatten Binary Tree to Linked List33treeRecursion
Stack
115Distinct Subsequences42stringDP
116Populating Next Right Pointers in Each Node33treeDFS
117Populating Next Right Pointers in Each Node II42treeDFS
118Pascal's Triangle21array
119Pascal's Triangle II21array
120Triangle31arrayDP
121Best Time to Buy and Sell Stock21arrayDP
122Best Time to Buy and Sell Stock II31arraygreedy
123Best Time to Buy and Sell Stock III41arrayDP
124Binary Tree Maximum Path Sum42treeDFS
125Valid Palindrome25stringTwo Pointers
126Word Ladder II11
127Word Ladder35graphBFS
shortest path
128Longest Consecutive Sequence43array
129Sum Root to Leaf Numbers24treeDFS
130Surrounded Regions43arrayBFS
DFS
131Palindrome Partitioning34stringDFS
132Palindrome Partitioning II43stringDP
思路方法总结:

题目算法数据结构注意事项
Clone GraphBFS哈希表
Word Ladder IIBFS哈希表
Surrounded RegionsBFS矩阵
Word LadderBFSN/A
Binary Tree Level Order TraversalBFS|前序遍历队列
Binary Tree Level Order Traversal IIBFS|前序遍历队列
Binary Tree Zigzag Level Order Traversal BFS|前序遍历队列每一层顺序分别对待
Implement strStr()KMP算法N/A
Copy List with Random PointerN/A哈希表
Remove Duplicates from Sorted ArrayN/A哈希表
Remove Duplicates from Sorted Array IIN/A哈希表
Set Matrix ZeroesN/A哈希表
AnagramsN/A哈希表
First Missing PositiveN/A哈希表
Two SumN/A哈希表
Evaluate Reverse Polish NotationN/A堆栈
Largest Rectangle in HistogramN/A堆栈记录重要位置
Minimum Window SubstringN/A堆栈
Simplify PathN/A堆栈
Longest Valid ParenthesesN/A堆栈
Valid ParenthesesN/A堆栈词法分析
Container With Most WaterN/A堆栈记录重要位置
Reverse Words in a StringN/A堆栈翻转字符串
Best Time to Buy and Sell StockN/A数组
Best Time to Buy and Sell Stock IIN/A数组
Best Time to Buy and Sell Stock IIIN/A数组
Length of Last WordN/A数组
Search Insert PositionN/A数组
Search for a RangeN/A数组
Spiral MatrixN/A矩阵简化为子问题
Spiral Matrix IIN/A矩阵简化为子问题
LRU CacheN/A链表
Reorder ListN/A链表快慢指针&链表倒序
Linked List CycleN/A链表快慢指针
Linked List Cycle IIN/A链表快慢指针
Reverse Linked List IIN/A链表
Partition ListN/A链表
Remove Duplicates from Sorted ListN/A链表
Remove Duplicates from Sorted List IIN/A链表
Merge Two Sorted ListsN/A链表
Rotate ListN/A链表快慢指针
Reverse Nodes in k-GroupN/A链表
Swap Nodes in PairsN/A链表
Remove Nth Node From End of ListN/A链表快慢指针
Text JustificationN/A队列
CandyN/AN/A简化为子问题
Valid PalindromeN/AN/A首尾指针
Plus OneN/AN/A模拟加法运算
Valid NumberN/AN/A词法分析
Add BinaryN/AN/A模拟加法运算
Insert IntervalN/AN/A
Merge IntervalsN/AN/A
Multiply StringsN/AN/A模拟乘法运算
Trapping Rain WaterN/AN/A
Valid SudokuN/AN/A
Roman to IntegerN/AN/A
Integer to RomanN/AN/A
Palindrome NumberN/AN/A
Reverse IntegerN/AN/A
ZigZag ConversionN/AN/A
Add Two NumbersN/AN/A模拟加法运算
Median of Two Sorted ArraysN/AN/A
String to Integer (atoi)STL函数N/A
Next PermutationSTL经典算法N/A
Recover Binary Search Tree中序遍历二叉树
3Sum二分查找N/A
3Sum Closest二分查找N/A
4Sum二分查找N/A
Single Number位运算N/A
Single Number II位运算N/A
Construct Binary Tree from Preorder and Inorder Traversal前序中序遍历N/A
Binary Tree Preorder Traversal前序遍历二叉树
Flatten Binary Tree to Linked List前序遍历二叉树
Interleaving String动态规划二叉树
Unique Binary Search Trees动态规划二叉树
Word Break动态规划N/A
Word Break II动态规划N/A
Palindrome Partitioning动态规划N/A
Palindrome Partitioning II动态规划N/A
Triangle动态规划N/A
Distinct Subsequences动态规划N/A
Decode Ways动态规划N/A
Scramble String动态规划N/A
Maximal Rectangle动态规划N/A
Edit Distance动态规划N/A
Climbing Stairs动态规划N/A
Minimum Path Sum动态规划N/A
Unique Paths动态规划N/A
Unique Paths II动态规划N/A
Jump Game动态规划N/A
Jump Game II动态规划N/A
Maximum Subarray动态规划N/A
Wildcard Matching动态规划N/A
Substring with Concatenation of All Words动态规划N/A
Sort List合并排序链表快慢指针
Merge Sorted Array合并排序N/A
Construct Binary Tree from Inorder and Postorder Traversal后序中序遍历N/A
Binary Tree Postorder Traversal后续遍历二叉树
Combinations回溯N/A
Permutation Sequence回溯N/A
N-Queens回溯N/A
N-Queens II回溯N/A
Permutations回溯N/A
Permutations II回溯N/A
Combination Sum回溯N/A
Combination Sum II回溯N/A
Sudoku Solver回溯N/A
Longest Substring Without Repeating Characters回溯N/A
Max Points on a Line循环遍历N/A排除相同的点
Longest Common Prefix循环遍历N/A
Longest Palindromic Substring循环遍历N/A
Insertion Sort List插入排序链表
Rotate Image矢量旋转与平移N/A
Longest Consecutive Sequence类BFS哈希表
Search in Rotated Sorted Array类二分查找N/A
Search in Rotated Sorted Array II类二分查找N/A特殊考虑相等数据
Sqrt(x)类二分查找N/A
Pow(x, n)类二进制N/A
Divide Two Integers类二进制N/A
Gas Station类合并排序N/A
Merge k Sorted Lists类外排序N/A
Sort Colors类快速排序N/A
Remove Element类快速排序N/A
Search a 2D Matrix类杨氏矩阵N/A
Restore IP Addresses背包问题N/A
Sum Root to Leaf Numbers递归二叉树
Binary Tree Maximum Path Sum递归二叉树
opulating Next Right Pointers in Each Node递归二叉树
Populating Next Right Pointers in Each Node II递归二叉树
Path Sum递归二叉树
Path Sum II递归二叉树
Maximum Depth of Binary Tree 递归二叉树
Minimum Depth of Binary Tree递归二叉树
Balanced Binary Tree递归二叉树
Symmetric Tree递归二叉树
Same Tree 递归二叉树
Validate Binary Search Tree递归二叉树
Unique Binary Search Trees II递归二叉树
Binary Tree Inorder Traversal递归二叉树
Pascal's Triangle递归N/A
Pascal's Triangle II递归N/A
Convert Sorted List to Binary Search Tree递归N/A快慢指针&反中序遍历
Convert Sorted Array to Binary Search Tree递归N/A反中序遍历
Subsets递归N/A
Subsets II递归N/A
Gray Code递归N/A
Word Search递归N/A
Count and Say递归N/A
Generate Parentheses递归N/A
Letter Combinations of a Phone Number递归N/A
Regular Expression Matching递归N/A
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: