常用算法记录(二)
常用的面试算法题记录
- 二分法
- 数组
- 快排
- 75. 颜色分类 https://leetcode.cn/problems/sort-colors/
- 三路快排
- 88题 归并排序的归并
- 215题 经典问题 找第K大元素
- 排序Onlogn
- 快排On就可以。二分法的原理
- 对撞指针
- 167题 https://leetcode.cn/problems/two-sum-ii-input-array-is-sorted/
- 11题 https://leetcode.cn/problems/container-with-most-water/description/
- 滑动窗口(也是两个指针)
- 209题 https://leetcode.cn/problems/minimum-size-subarray-sum/
- 3题 https://leetcode.cn/problems/longest-substring-without-repeating-characters/
- 438题 https://leetcode.cn/problems/find-all-anagrams-in-a-string/description/
- 76题 https://leetcode.cn/problems/minimum-window-substring/description/
- 567 https://leetcode.cn/problems/permutation-in-string/description/
- 查找表
- set 基本用法 349 https://leetcode.cn/problems/intersection-of-two-arrays/description/
- Map 基本用法 350 https://leetcode.cn/problems/intersection-of-two-arrays-ii/description/
- 1题 https://leetcode.cn/problems/two-sum/description/
- 15题3数之和 https://leetcode.cn/problems/3sum/
- 18题 4数之和 https://leetcode.cn/problems/4sum/description/
- 16题 https://leetcode.cn/problems/3sum-closest/description/
- 链表
- 206 https://leetcode.cn/problems/reverse-linked-list/
- 92题 https://leetcode.cn/problems/reverse-linked-list-ii/description/
- 83题
- 86题
- 328题 https://leetcode.cn/problems/odd-even-linked-list/description/
- 2题
- 445题 https://leetcode.cn/problems/add-two-numbers-ii/description/
- 链表虚拟头结点
- 203题 https://leetcode.cn/problems/remove-linked-list-elements/
- 82题 https://leetcode.cn/problems/remove-duplicates-from-sorted-list-ii/description/
- 21题 https://leetcode.cn/problems/merge-two-sorted-lists/description/
- 复杂的穿针引线 5.4节
- 24题 https://leetcode.cn/problems/swap-nodes-in-pairs/description/
- 25题 https://leetcode.cn/problems/reverse-nodes-in-k-group/
- 147题 https://leetcode.cn/problems/insertion-sort-list/description/
- 148题 https://leetcode.cn/problems/sort-list/
- 不仅仅是穿针引线
- 链表&双指针
- 19题 https://leetcode.cn/problems/remove-nth-node-from-end-of-list/
- 61题 https://leetcode.cn/problems/rotate-list/description/
- 143题 https://leetcode.cn/problems/reorder-list/
- 234题 https://leetcode.cn/problems/palindrome-linked-list/
- 递归和回溯法(回溯是暴力解法,可以通过剪枝降低复杂度)
- 17题 https://leetcode.cn/problems/letter-combinations-of-a-phone-number/submissions/
- 93题 https://leetcode.cn/problems/restore-ip-addresses/
- 131题 https://leetcode.cn/problems/palindrome-partitioning/description/
- 排列问题
- 46题 https://leetcode.cn/problems/permutations/ 借助数学推理 可以有更高效的方法
- 47题 https://leetcode.cn/problems/permutations-ii/
- 组合问题
- 77题 https://leetcode.cn/problems/combinations/description/
- 39题 https://leetcode.cn/problems/combination-sum/description/
- 40题 https://leetcode.cn/problems/combination-sum-ii
- 216题 https://leetcode.cn/problems/combination-sum-iii/description/
- 78题 https://leetcode.cn/problems/subsets/description/
- 90题 https://leetcode.cn/problems/subsets-ii/description/
- 二维平面上的回溯法
- 动态规划
- 记忆化搜索 自顶向下的
- 斐波那契数列 fib(n-1 )+ fib(n-2); 这种写法性能低。指数级的复杂度。
- 用一个int[n]记录结果。O(n)复杂度。性能问题。还需要考虑越界,取模。
- 用hash也行,没有数组方便。
- 动态规划 自底向上解决问题
- 70题 https://leetcode.cn/problems/climbing-stairs/description/
- 120题 https://leetcode.cn/problems/triangle/description/
- 64题 https://leetcode.cn/problems/minimum-path-sum/description/
- 343题 https://leetcode.cn/problems/integer-break/description/
- 自顶向下 记忆搜索 arr[i] 递归
- 自底向上 动态规划 arr[n] 双重循环 求arr[n]
- 279 https://leetcode.cn/problems/perfect-squares/description/
- 91题 https://leetcode.cn/problems/decode-ways/description/
- 62题 https://leetcode.cn/problems/unique-paths/description/
- 贪心算法