LeetCode/CodingInterview.md
ShusenTang 0f3807f599 add 42
2020-02-09 19:35:16 +08:00

56 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 《剑指offer》第2版对应LeetCode题目
《剑指offer》第2版中的面试题对应的LeetCode题目。
* 编号:题目在书中的编号;
* 题目:[《牛客网剑指offer专题》](https://www.nowcoder.com/ta/coding-interviews?page=1)对应题目链接这是第1版的所以第2版有的题目这里没有
* LeetCode: 对应LeetCode题目的题解链接
| 编号 | 题目 | LeetCode | 备注 |
| ---- | --- | ----- | ----- |
| 3 | [数组中重复的数字](https://www.nowcoder.com/practice/623a5ac0ea5b4e5f95552655361ae0a8?tpId=13&tqId=11203&tPage=3&rp=3&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [287. Find the Duplicate Number](solutions/287.%20Find%20the%20Duplicate%20Number.md)| 注意细微差别 |
| 4 | [二维数组中的查找](https://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e?tpId=13&tqId=11154&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [240. Search a 2D Matrix II](solutions/240.%20Search%20a%202D%20Matrix%20II.md)|
| 7 | [重建二叉树](https://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6?tpId=13&tqId=11157&tPage=1&rp=3&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [105. Construct Binary Tree from Preorder and Inorder Traversal](solutions/105.%20Construct%20Binary%20Tree%20from%20Preorder%20and%20Inorder%20Traversal.md)|
| 9 | [用两个栈实现队列](https://www.nowcoder.com/practice/54275ddae22f475981afa2244dd448c6?tpId=13&tqId=11158&tPage=1&rp=3&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [232. Implement Queue using Stacks](solutions/232.%20Implement%20Queue%20using%20Stacks.md)|
| 10 | [斐波那契数列](https://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3?tpId=13&tqId=11160&tPage=1&rp=3&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [509. Fibonacci Number](solutions/509.%20Fibonacci%20Number.md), [70. Climbing Stairs](solutions/70.%20Climbing%20Stairs.md)|
| 11 | [旋转数组中的最小数字](https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba?tpId=13&tqId=11159&tPage=1&rp=3&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [153. Find Minimum in Rotated Sorted Array](solutions/153.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array.md)|
| 12 | [矩阵中的路径](https://www.nowcoder.com/practice/c61c6999eecb4b8f88a98f66b273a3cc?tpId=13&tqId=11218&tPage=4&rp=4&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [79. Word Search](solutions/79.%20Word%20Search.md)|
| 15 | [二进制中1的个数](https://www.nowcoder.com/practice/8ee967e43c2c4ec193b040ea7fbb10b8?tpId=13&tqId=11164&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [191. Number of 1 Bits](solutions/191.%20Number%20of%201%20Bits.md)|
| 16 | [数值的整数次方](https://www.nowcoder.com/practice/1a834e5e3e1a4b7ba251417554e07c00?tpId=13&tqId=11165&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [50. Pow(x, n)](solutions/50.%20Pow(x%2C%20n).md)|
| 18 | 一、在O(1)时间内删除链表节点 | [237. Delete Node in a Linked List](solutions/237.%20Delete%20Node%20in%20a%20Linked%20List.md)| 略有不同 |
| 18 | [二、删除链表中重复的节点](https://www.nowcoder.com/practice/fc533c45b73a41b0b44ccba763f866ef?tpId=13&tqId=11209&tPage=3&rp=3&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [82. Remove Duplicates from Sorted List II](solutions/82.%20Remove%20Duplicates%20from%20Sorted%20List%20II.md)|
| 19 | [正则表达式匹配](https://www.nowcoder.com/practice/45327ae22b7b413ea21df13ee7d6429c?tpId=13&tqId=11205&tPage=3&rp=3&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [10. Regular Expression Matching](solutions/10.%20Regular%20Expression%20Matching.md)|
| 20 | [表示数值的字符串](https://www.nowcoder.com/practice/6f8c901d091949a5837e24bb82a731f2?tpId=13&tqId=11206&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [65. Valid Number](solutions/65.%20Valid%20Number.md)|
| 21 | [调整数组顺序使奇数位于偶数之前](https://www.nowcoder.com/practice/6f8c901d091949a5837e24bb82a731f2?tpId=13&tqId=11206&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [905. Sort Array By Parity](solutions/905.%20Sort%20Array%20By%20Parity.md)| 要求刚好相反 |
| 22 | [链表中倒数第k个节点](https://www.nowcoder.com/practice/529d3ae5a407492994ad2a246518148a?tpId=13&tqId=11167&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [19. Remove Nth Node From End of List](solutions/19.%20Remove%20Nth%20Node%20From%20End%20of%20List.md)| 查找然后删除 |
| 23 | [链表中环的入口节点](https://www.nowcoder.com/practice/253d2c59ec3e4bc68da16833f79a38e4?tpId=13&tqId=11208&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [142. Linked List Cycle II](solutions/142.%20Linked%20List%20Cycle%20II.md)| |
| 24 | [反转链表](https://www.nowcoder.com/practice/75e878df47f24fdc9dc3e400ec6058ca?tpId=13&tqId=11168&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [206. Reverse Linked List](solutions/206.%20Reverse%20Linked%20List.md)| |
| 25 | [合并两个排序的链表](https://www.nowcoder.com/practice/d8b6b4358f774294a89de2a6ac4d9337?tpId=13&tqId=11169&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [21. Merge Two Sorted Lists](solutions/21.%20Merge%20Two%20Sorted%20Lists.md)| |
| 26 | [树的子结构](https://www.nowcoder.com/practice/6e196c44c7004d15b1610b9afca8bd88?tpId=13&tqId=11170&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [572. Subtree of Another Tree](solutions/572.%20Subtree%20of%20Another%20Tree.md)| 略有不同 |
| 27 | [二叉树的镜像](https://www.nowcoder.com/practice/564f4c26aa584921bc75623e48ca3011?tpId=13&tqId=11171&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [226. Invert Binary Tree](solutions/226.%20Invert%20Binary%20Tree.md)|
| 28 | [对称的二叉树](https://www.nowcoder.com/practice/ff05d44dfdb04e1d83bdbdab320efbcb?tpId=13&tqId=11211&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [101. Symmetric Tree](solutions/101.%20Symmetric%20Tree.md)|
| 29 | [顺时针打印矩阵](https://www.nowcoder.com/practice/9b4c81a02cd34f76be2659fa0d54342a?tpId=13&tqId=11172&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [54. Spiral Matrix](solutions/54.%20Spiral%20Matrix.md)|
| 30 | [包含min函数的栈](https://www.nowcoder.com/practice/4c776177d2c04c2494f2555c9fcc1e49?tpId=13&tqId=11173&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [155. Min Stack](solutions/155.%20Min%20Stack.md)|
| 31 | [栈的压入、弹出序列](https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&tqId=11174&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [946. Validate Stack Sequences](solutions/946.%20Validate%20Stack%20Sequences.md)|
| 32 | [一、不分行从上到下打印二叉树](https://www.nowcoder.com/practice/7fe2212963db4790b57431d9ed259701?tpId=13&tqId=11175&tPage=2&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | 无|
| 32 | [二、分行从上到下打印二叉树](https://www.nowcoder.com/practice/445c44d982d04483b04a54f298796288?tpId=13&tqId=11213&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [102. Binary Tree Level Order Traversal](solutions/102.%20Binary%20Tree%20Level%20Order%20Traversal.md)|
| 32 | [三、之字型打印二叉树](https://www.nowcoder.com/practice/91b69814117f4e8097390d107d2efbe0?tpId=13&tqId=11212&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [103. Binary Tree Zigzag Level Order Traversal](solutions/103.%20Binary%20Tree%20Zigzag%20Level%20Order%20Traversal.md)|
| 33 | [二叉搜索树的后序遍历序列](https://www.nowcoder.com/practice/a861533d45854474ac791d90e447bafd?tpId=13&tqId=11176&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | 255. Verify Preorder Sequence in Binary Search Tree | 有锁 |
| 34 | [二叉树中和为某一值的路径](https://www.nowcoder.com/practice/b736e784e3e34731af99065031301bca?tpId=13&tqId=11177&tPage=2&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [113. Path Sum II](solutions/113.%20Path%20Sum%20II.md)|
| 35 | [复杂链表的复制](https://www.nowcoder.com/practice/f836b2c43afc4b35ad6adc41ec941dba?tpId=13&tqId=11178&tPage=2&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [138. Copy List with Random Pointer](solutions/138.%20Copy%20List%20with%20Random%20Pointer.md)|
| 36 | [二叉搜索树与双向链表](https://www.nowcoder.com/practice/947f6eb80d944a84850b0538bf0ec3a5?tpId=13&tqId=11179&tPage=2&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | 426. Convert Binary Search Tree to Sorted Doubly Linked List | 有锁 |
| 37 | [序列化二叉树](https://www.nowcoder.com/practice/cf7e25aa97c04cc1a68c8f040e71fb84?tpId=13&tqId=11214&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [297. Serialize and Deserialize Binary Tree](solutions/297.%20Serialize%20and%20Deserialize%20Binary%20Tree.md)|
| 38 | 字符串的排列 | [46. Permutations](solutions/46.%20Permutations.md)| 无重复元素 |
| 38 | [字符串的排列](https://www.nowcoder.com/practice/fe6b651b66ae47d7acce78ffdd9a96c7?tpId=13&tqId=11180&tPage=2&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [47. Permutations II](solutions/47.%20Permutations%20II.md)| 有重复元素 |
| 38 | 扩展:字符串的组合 | [77. Combinations](solutions/77.%20Combinations.md)|
| 39 | [数组中出现次数超过一半的数字](https://www.nowcoder.com/practice/e8a1b01a2df14cb2b228b30ee6a92163?tpId=13&tqId=11181&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [169. Majority Element](solutions/169.%20Majority%20Element.md)|
| 40 | [最小的k个数](https://www.nowcoder.com/practice/6a296eb82cf844ca8539b57c23e6e9bf?tpId=13&tqId=11182&tPage=2&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking) | [215. Kth Largest Element in an Array](solutions/215.%20Kth%20Largest%20Element%20in%20an%20Array.md)| 略有不同 |
| 41 | [数据流中的中位数](https://www.nowcoder.com/practice/9be0172896bd43948f8a32fb954e1be1?tpId=13&tqId=11216&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [295. Find Median from Data Stream](solutions/295.%20Find%20Median%20from%20Data%20Stream.md)|
| 42 | [连续子数组的最大和](https://www.nowcoder.com/practice/459bd355da1549fa8a49e350bf3df484?tpId=13&tqId=11183&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) | [53. Maximum Subarray](solutions/53.%20Maximum%20Subarray.md)|
## 参考
* [yanring - 剑指offer leetcode 对应](https://gist.github.com/yanring/fd7c494616f99052d1fea3bc788cc800)
* [NeilHUI - 剑指offer leetcode 对应编程练习记录](https://github.com/NeilHUI/LeetCode)