一整套题下来,还怕面试?
上链接:https://www.educative.io/courses/grokking-the-coding-interview?aff=K7qB
我自己也补充了一些比较重要的模式和经典算法,自行按类型找题,后期会再更新
下面我们就来看看的分类及每个类型的经典题目:
1. Introduction
大概就是说这是帮助你进入顶级公司的一套课程,学习之前,
需要具备有一些数据结构的知识。。。
2. Pattern: Sliding Window,滑动窗口
Smallest Subarray with a given sum
Longest Substring with K Distinct Characters (medium)
No-repeat Substring (hard)
Longest Substring with Same Letters after Replacement (hard)
Longest Subarray with Ones after Replacement (hard)
3. Pattern: two points, 双指针类型
Pair with Target Sum (easy)
Remove Duplicates (easy)
Squaring a Sorted Array (easy)
Triplet Sum to Zero (medium)
Triplet Sum Close to Target (medium)
Triplets with Smaller Sum (medium)
Subarrays with Product Less than a Target (medium)
Dutch National Flag Problem (medium)
4. Pattern: Fast & Slow pointers, 快慢指针类型
经典题目:
LinkedList Cycle (easy)
Start of LinkedList Cycle (medium)
Happy Number (medium)
Middle of the LinkedList (easy)
5. Pattern: Merge Intervals,区间合并类型
经典题目:
Merge Intervals (medium)
Insert Interval (medium)
Intervals Intersection (medium)
Conflicting Appointments (medium)
6. Pattern: Cyclic Sort,循环排序
经典题目:
Cyclic Sort (easy)
Find the Missing Number (easy)
Find all Missing Numbers (easy)
Find the Duplicate Number (easy)
Find all Duplicate Numbers (easy)
7. Pattern: In-place Reversal of a LinkedList,链表翻转
经典题目:
Reverse a LinkedList (easy)
Reverse a Sub-list (medium)
Reverse every K-element Sub-list (medium)
8. Pattern: Tree Breadth First Search,树上的BFS
经典题目:
Binary Tree Level Order Traversal (easy)
Reverse Level Order Traversal (easy)
Zigzag Traversal (medium)
Level Averages in a Binary Tree (easy)
Minimum Depth of a Binary Tree (easy)
Level Order Successor (easy)
Connect Level Order Siblings (medium)
9. Pattern: Tree Depth First Search,树上的DFS
经典题目:
Binary Tree Path Sum (easy)
All Paths for a Sum (medium)
Sum of Path Numbers (medium)
Path With Given Sequence (medium)
Count Paths for a Sum (medium)
10. Pattern: Two Heaps,双堆类型
经典题目:
Find the Median of a Number Stream (medium)
Sliding Window Median (hard)
Maximize Capital (hard)
11. Pattern: Subsets,子集类型,一般都是使用多重DFS
经典题目:
Subsets (easy)
Subsets With Duplicates (easy)
Permutations (medium)
String Permutations by changing case (medium)
Balanced Parentheses (hard)
Unique Generalized Abbreviations (hard)
12. Pattern: Modified Binary Search,改造过的二分
经典题目:
Order-agnostic Binary Search (easy)
Ceiling of a Number (medium)
Next Letter (medium)
Number Range (medium)
Search in a Sorted Infinite Array (medium)
Minimum Difference Element (medium)
Bitonic Array Maximum (easy)
13. Pattern: Bitwise XOR
Single Number (easy)
Two Single Numbers (medium)
Complement of Base 10 Number (medium)
14. Pattern: Top ‘K’ Elements,前K个系列
经典题目:
Top ‘K’ Numbers (easy)
Kth Smallest Number (easy)
‘K’ Closest Points to the Origin (easy)
Connect Ropes (easy)
Top ‘K’ Frequent Numbers (medium)
Frequency Sort (medium)
Kth Largest Number in a Stream (medium)
‘K’ Closest Numbers (medium)
Maximum Distinct Elements (medium)
Sum of Elements (medium)
Rearrange String (hard)
15. Pattern: K-way merge,多路归并
经典题目:
Merge K Sorted Lists (medium)
Kth Smallest Number in M Sorted Lists (Medium)
Kth Smallest Number in a Sorted Matrix (Hard)
Smallest Number Range (Hard)
16. Pattern: 0/1 Knapsack (Dynamic Programming),0/1背包类型
经典题目:
0/1 Knapsack (medium)
Equal Subset Sum Partition (medium)
Subset Sum (medium)
Minimum Subset Sum Difference (hard)
17. Pattern: Topological Sort (Graph),拓扑排序类型
经典题目:
Topological Sort (medium)
Tasks Scheduling (medium)
Tasks Scheduling Order (medium)
All Tasks Scheduling Orders (hard)
Alien Dictionary (hard)
18. 并查集
Kruskal(图的最小生成树问题)