LeetCode-分类题解

数组

Remove Duplicates from Sorted Array  Remove Duplicates from Sorted Array II  Search in Rotated Sorted Array  Search in Rotated Sorted Array II  Median of Two Sorted Arrays  Longest Consecutive Sequence  Two Sum  3Sum  3Sum Closest  4Sum  Remove Element  Next Permutation  Permutation Sequence  Valid Sudoku  Trapping Rain Water  Rotate Image  Plus One  Climbing Stairs  Gray Code Set Matrix Zeroes  Gas Station  Candy  Single Number  Single Number II

http://oj.leetcode.com/problems/remove-element/
http://oj.leetcode.com/problems/merge-sorted-array/
http://oj.leetcode.com/problems/first-missing-positive/
http://oj.leetcode.com/problems/spiral-matrix/
http://oj.leetcode.com/problems/spiral-matrix-ii/
http://oj.leetcode.com/problems/rotate-image/

遍历技巧:http://oj.leetcode.com/problems/container-with-most-water/
http://oj.leetcode.com/problems/two-sum/
http://oj.leetcode.com/problems/3sum/
http://oj.leetcode.com/problems/3sum-closest/
http://oj.leetcode.com/problems/4sum/
http://oj.leetcode.com/problems/set-matrix-zeroes/
用好标记数组:http://oj.leetcode.com/problems/valid-sudoku/
http://oj.leetcode.com/problems/next-permutation/
http://oj.leetcode.com/problems/word-search/
http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/
http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/
http://oj.leetcode.com/problems/sort-colors/

 

字符串

Valid Palindrome  Implement strStr()  String to Integer (atoi)  Add Binary  Longest Palindromic Substring  Regular Expression Matching  Wildcard Matching  Longest Common Prefix  Valid Number Integer to Roman  Roman to Integer  Count and Say  Anagrams  Simplify Path  Length of Last Word

http://oj.leetcode.com/problems/count-and-say/
http://oj.leetcode.com/problems/implement-strstr/ (子串查找)
http://oj.leetcode.com/problems/anagrams/
http://oj.leetcode.com/problems/text-justification/ (细节)
http://oj.leetcode.com/problems/simplify-path/ (基础控制语句 if-else-for)
http://oj.leetcode.com/problems/multiply-strings/
http://oj.leetcode.com/problems/regular-expression-matching/
http://oj.leetcode.com/problems/wildcard-matching/
http://oj.leetcode.com/problems/longest-palindromic-substring/
http://oj.leetcode.com/problems/zigzag-conversion/
http://oj.leetcode.com/problems/length-of-last-word/
http://oj.leetcode.com/problems/valid-palindrome/

 

链表

Add Two Numbers  Reverse Linked List II  Partition List  Remove Duplicates from Sorted List  Remove Duplicates from Sorted List II  Rotate List  Remove Nth Node From End of List  Swap Nodes in Pairs Reverse Nodes in k-Group  Copy List with Random Pointer  Linked List Cycle  Linked List Cycle II Reorder List  LRU Cache

归并排序:http://oj.leetcode.com/problems/sort-list/
插入排序:http://oj.leetcode.com/problems/insertion-sort-list/
反转、插入:http://oj.leetcode.com/problems/reorder-list/
检测是否有环:http://oj.leetcode.com/problems/linked-list-cycle/
确定链表环的起点:http://oj.leetcode.com/problems/linked-list-cycle-ii/
Deep Copy 带有随机指针的链表:http://oj.leetcode.com/problems/copy-list-with-random-pointer/
链表细节:http://oj.leetcode.com/problems/rotate-list/
http://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/
删除细节:http://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/
http://oj.leetcode.com/problems/partition-list/
http://oj.leetcode.com/problems/swap-nodes-in-pairs/
Merge 两个链表:http://oj.leetcode.com/problems/merge-two-sorted-lists/
Merge 多链表:http://oj.leetcode.com/problems/merge-k-sorted-lists/
细节:http://oj.leetcode.com/problems/reverse-nodes-in-k-group/
http://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/
http://oj.leetcode.com/problems/reverse-linked-list-ii/

 

二叉树

Binary Tree Preorder Traversal  Binary Tree Inorder Traversal  Binary Tree Postorder Traversal  Binary Tree Level Order Traversal  Binary Tree Level Order Traversal II  Binary Tree Zigzag Level Order Traversal Recover Binary Search Tree  Same Tree  Symmetric Tree  Balanced Binary Tree  Flatten Binary Tree to Linked List  Populating Next Right Pointers in Each Node II  Construct Binary Tree from Preorder and Inorder Traversal  Construct Binary Tree from Inorder and Postorder Traversal  Unique Binary Search Trees  Unique Binary Search Trees II  Validate Binary Search Tree  Convert Sorted Array to Binary Search Tree  Convert Sorted List to Binary Search Tree  Minimum Depth of Binary Tree  Maximum Depth of Binary Tree  Path Sum  Path Sum II  Binary Tree Maximum Path Sum  Populating Next Right Pointers in Each Node  Sum Root to Leaf Numbers

二叉树遍历:递归 & 非递归
http://oj.leetcode.com/problems/same-tree/
前序:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/
中序:http://oj.leetcode.com/problems/binary-tree-inorder-traversal/
后序:http://oj.leetcode.com/problems/binary-tree-postorder-traversal/
遍历变种:http://oj.leetcode.com/problems/sum-root-to-leaf-numbers/
遍历变种:http://oj.leetcode.com/problems/path-sum/
遍历变种:http://oj.leetcode.com/problems/path-sum-ii/
遍历变种:http://oj.leetcode.com/problems/maximum-depth-of-binary-tree/
遍历变种:http://oj.leetcode.com/problems/minimum-depth-of-binary-tree/
重建二叉树:http://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/
重建二叉树:http://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/
层次遍历变种:http://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/
遍历变种:http://oj.leetcode.com/problems/symmetric-tree/
遍历应用:http://oj.leetcode.com/problems/binary-tree-maximum-path-sum/
遍历应用:http://oj.leetcode.com/problems/balanced-binary-tree/
遍历应用:http://oj.leetcode.com/problems/recover-binary-search-tree/
遍历应用:http://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/
level遍历:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/
level 遍历:http://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/
level 遍历变种:http://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/
level 遍历变种:http://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/

 

排序 & 查找

Merge Sorted Array  Merge Two Sorted Lists  Merge k Sorted Lists  Insertion Sort List  Sort List  First Missing Positive  Sort Colors

Search for a Range  Search Insert Position  Search a 2D Matrix


二分查找:http://oj.leetcode.com/problems/search-a-2d-matrix/
二分查找进阶:http://oj.leetcode.com/problems/search-for-a-range/
二分查找应用:http://oj.leetcode.com/problems/sqrtx/
二分查找应用:http://oj.leetcode.com/problems/search-insert-position/
二分查找变种:http://oj.leetcode.com/problems/search-in-rotated-sorted-array/
二分查找变种:http://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/

 

动态规划

Triangle  Maximum Subarray  Palindrome Partitioning II  Maximal Rectangle  Best Time to Buy and Sell Stock III  Interleaving String  Scramble String  Minimum Path Sum  Edit Distance  Decode Ways Distinct Subsequences  Word Break  Word Break II

http://oj.leetcode.com/problems/triangle/ (最短路径)
http://oj.leetcode.com/problems/subsets/ (另一种形式)
http://oj.leetcode.com/problems/subsets-ii/
http://oj.leetcode.com/problems/edit-distance/ (经典)
http://oj.leetcode.com/problems/word-break/
http://oj.leetcode.com/problems/word-break-ii/
http://oj.leetcode.com/problems/unique-binary-search-trees/ (动态规划避免递归)
http://oj.leetcode.com/problems/unique-paths-ii/
http://oj.leetcode.com/problems/scramble-string/
http://oj.leetcode.com/problems/palindrome-partitioning/
http://oj.leetcode.com/problems/palindrome-partitioning-ii/
http://oj.leetcode.com/problems/interleaving-string/
http://oj.leetcode.com/problems/distinct-subsequences/
http://oj.leetcode.com/problems/decode-ways/
http://oj.leetcode.com/problems/gray-code/
http://oj.leetcode.com/problems/minimum-path-sum/

 

分治 & 递归

http://oj.leetcode.com/problems/unique-binary-search-trees-ii/
http://oj.leetcode.com/problems/restore-ip-addresses/ (时间复杂度有限,递归满足)
http://oj.leetcode.com/problems/permutations/
http://oj.leetcode.com/problems/permutations-ii/
http://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/
http://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/
http://oj.leetcode.com/problems/median-of-two-sorted-arrays/
http://oj.leetcode.com/problems/validate-binary-search-tree/

 

贪心算法

Jump Game  Jump Game II  Best Time to Buy and Sell Stock  Best Time to Buy and Sell Stock II Longest Substring Without Repeating Characters  Container With Most Water

http://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/
http://oj.leetcode.com/problems/jump-game/
http://oj.leetcode.com/problems/jump-game-ii/
http://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
http://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/
http://oj.leetcode.com/problems/maximum-subarray/
http://oj.leetcode.com/problems/minimum-window-substring/
http://oj.leetcode.com/problems/maximal-rectangle/
http://oj.leetcode.com/problems/longest-substring-without-repeating-characters/

 

回溯

http://oj.leetcode.com/problems/combinations/
http://oj.leetcode.com/problems/generate-parentheses/
http://oj.leetcode.com/problems/combination-sum/
http://oj.leetcode.com/problems/combination-sum-ii/
http://oj.leetcode.com/problems/sudoku-solver/
经典N皇后:http://oj.leetcode.com/problems/n-queens/
http://oj.leetcode.com/problems/n-queens-ii/
http://oj.leetcode.com/problems/letter-combinations-of-a-phone-number/

 

大数运算

http://oj.leetcode.com/problems/add-binary/
http://oj.leetcode.com/problems/add-two-numbers/

 

简单数学

http://oj.leetcode.com/problems/pascals-triangle/
http://oj.leetcode.com/problems/pascals-triangle-ii/
http://oj.leetcode.com/problems/powx-n/
http://oj.leetcode.com/problems/reverse-integer/
http://oj.leetcode.com/problems/plus-one/
http://oj.leetcode.com/problems/unique-paths/
http://oj.leetcode.com/problems/palindrome-number/
http://oj.leetcode.com/problems/permutation-sequence/
http://oj.leetcode.com/problems/merge-intervals/
http://oj.leetcode.com/problems/valid-number/
http://oj.leetcode.com/problems/climbing-stairs/
http://oj.leetcode.com/problems/roman-to-integer/
http://oj.leetcode.com/problems/integer-to-roman/
http://oj.leetcode.com/problems/divide-two-integers/
区间:http://oj.leetcode.com/problems/insert-interval/

 

 

多种数据结构

http://oj.leetcode.com/problems/lru-cache/
http://oj.leetcode.com/problems/substring-with-concatenation-of-all-words/ (注意遍历方法)
HASH:http://oj.leetcode.com/problems/longest-consecutive-sequence/

posted @ 2017-11-22 10:13  hank的DL之路  阅读(411)  评论(0编辑  收藏  举报