别再埋头刷LeetCode之:北美算法面试的题目分类,按类型和规律刷题,事半功倍

11.07.2019 文末有更新。



算法面试过程中,题目类型多,数量大。大家都不可避免的会在LeetCode上进行训练。但问题是,题目杂,而且已经超过1000道题。全部刷完且掌握,不是一件容易的事情。那我们应该怎么办呢?找规律,总结才是制胜法宝。下面我们就来看看

Grokking the Coding Interview: Patterns for Coding Questionswww.educative.io图标

的分类及每个类型的经典题目。

(如果你需要上面这些算法课程,那么你可以使用
awesome-developer
的折扣码获得网站所有课程的额外15%off!上面的折扣码针对单独购买所有课程有效。

如果想买订阅( Subsriptions)的小伙伴,则可以用
ZHIHUEDU-10
的coupon code来获取额外九折的优惠
适用于按年和按月订阅):

他家最最出名的还是这门Grokking the System Design Interview, 但凡提到准备系统设计,这门课都上入门必推的:

Grokking the System Design Interview - Learn Interactivelywww.educative.io图标

以及OOD: Grokking the Object Oriented Design Interview

Grokking the Object Oriented Design Interview - Learn Interactivelywww.educative.io图标



1. Pattern: Sliding window,滑动窗口类型

经典题目:

Maximum Sum Subarray of Size K (easy)

Smallest Subarray with a given sum (easy)

Longest Substring with K Distinct Characters (medium)

Fruits into Baskets (medium)

No-repeat Substring (hard)

Longest Substring with Same Letters after Replacement (hard)

Longest Subarray with Ones after Replacement (hard)


2. 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)


3. Pattern: Fast & Slow pointers, 快慢指针类型

经典题目:

LinkedList Cycle (easy)

Start of LinkedList Cycle (medium)

Happy Number (medium)

Middle of the LinkedList (easy)


4. Pattern: Merge Intervals,区间合并类型

经典题目:

Merge Intervals (medium)

Insert Interval (medium)

Intervals Intersection (medium)

Conflicting Appointments (medium)


5. 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)


6. Pattern: In-place Reversal of a LinkedList,链表翻转

经典题目:

Reverse a LinkedList (easy)

Reverse a Sub-list (medium)

Reverse every K-element Sub-list (medium)


7. 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)


8. 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)


9. Pattern: Two Heaps,双堆类型

经典题目:

Find the Median of a Number Stream (medium)

Sliding Window Median (hard)

Maximize Capital (hard)


10. Pattern: Subsets,子集类型,一般都是使用多重DFS

经典题目:

Subsets (easy)

Subsets With Duplicates (easy)

Permutations (medium)

String Permutations by changing case (medium)

Balanced Parentheses (hard)

Unique Generalized Abbreviations (hard)


11. 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)


12. 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)


13. 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)


14. 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)


15. Pattern: Topological Sort (Graph),拓扑排序类型

经典题目:

Topological Sort (medium)

Tasks Scheduling (medium)

Tasks Scheduling Order (medium)

All Tasks Scheduling Orders (hard)

Alien Dictionary (hard)


大家好好练练这些题目,面试中遇到高等难度的题目,应该就能解得不错了。


如果你需要上面这些算法课程,那么你可以使用
awesome-developer
的折扣码获得网站所有课程的额外15%off!上面的折扣码针对单独购买所有课程有效。

如果想买订阅 Subsriptions)的小伙伴,则可以用
ZHIHUEDU-10
的coupon code来获取额外九折的优惠
适用于按年和按月订阅



11.07.2019更新:在看完评论区小伙伴的留言之后,我又去找了他们的官方课程介绍,花了五个小时,翻译完了,感兴趣的同学可以去参考:

穷码农:码农找工作之:秒杀算法面试必须掌握的14种模式zhuanlan.zhihu.com图标


11.15.2019更新:增加了另外一个角度解析上面这些模式的翻译文章:

穷码农:码农找工作之:准备算法面试的终极策略zhuanlan.zhihu.com图标


如果对你有帮助,请点赞和关注计算机基础知识和算法面试准备专栏:

程序员算法面试经验谈zhuanlan.zhihu.com图标

其他很多课程:

穷码农:网课党的双重大福利!Github学生账号和Educative合作,总共2000美金的课程免费半年啦zhuanlan.zhihu.com图标


以上。

编辑于 2020-05-18

文章被以下专栏收录

    程序员刷题找工作和学习计算机基础知识是一个长期的过程,该过程中需要有良好的计划和优质的执行。希望本专栏能给求职的你我他打开思路和提供绵薄的帮助!我会不断更新这些方面的内容,也算是自己转专业学习计算机的一个提炼。希望大家能打好基础,面试手到擒来。