LeetCode题目总结分类

注:此分类仅供大概参考,没有精雕细琢。有不同意见欢迎评论~

利用堆栈:
http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/
http://oj.leetcode.com/problems/longest-valid-parentheses/ (也可以用一维数组,贪心)
http://oj.leetcode.com/problems/valid-parentheses/
http://oj.leetcode.com/problems/largest-rectangle-in-histogram/
特别注意细节:http://oj.leetcode.com/problems/trapping-rain-water/

多种数据结构:
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/

简单编程:
http://oj.leetcode.com/problems/longest-common-prefix/
http://oj.leetcode.com/problems/string-to-integer-atoi/ (分析,控制语句)

排序 & 查找:
二分查找: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/

简单数学:
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/add-binary/
http://oj.leetcode.com/problems/add-two-numbers/

数组:
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/

暴力方法/细节实现:
http://oj.leetcode.com/problems/max-points-on-a-line/

链表:
归并排序: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/

二叉树遍历:递归 & 非递归
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/

问题分析/智商/细节:
http://oj.leetcode.com/problems/single-number/
http://oj.leetcode.com/problems/single-number-ii/
http://oj.leetcode.com/problems/candy/
http://oj.leetcode.com/problems/gas-station/

动态规划:
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/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/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/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/

字符串:
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/

图:
深搜/广搜:http://oj.leetcode.com/problems/clone-graph/

搜索 & 遍历:
http://oj.leetcode.com/problems/word-ladder/
http://oj.leetcode.com/problems/word-ladder-ii/
广搜:http://oj.leetcode.com/problems/surrounded-regions/

时间: 2024-11-07 19:00:34

LeetCode题目总结分类的相关文章

leetcode题目:Clone Graph

题目: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as a separator for each node, and , as a separator for node label and each n

【转】对于杭电OJ题目的分类

[好像博客园不能直接转载,所以我复制过来了..] 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDI

leetcode题目思路以及部分解答(一)

为了进好公司这一个多月就得抽时间刷leetcode了..感觉这个OJ很不严谨...好多边界条件都没说清处..不过还好可以推测.唯一的好处就是不用自己编译调试,可以直接在网上显示出结果.当然,复杂一点的题目为了调试自己构建题目的结构也是很麻烦的...所以我发现提交里面错误好多.....再就是在笔记本上会时不时的变卡...每次提交都得等个3,4分钟才成功.要不就502错误... 我的题目按照通过率来.从通过率最高的题目开始讲解.每题不一定是最优解,都是我想得.仅供参考. 题目标题我都标好了.可以用c

leetcode题目思路以及部分解答(二)

又刷了30题了,这速度还不错.因为还有别的东西要复习,所以进度并不快.感觉还是能学到很多新东西的.早知道这个就不用去其他地方刷了.这个难度不高,还可以知道哪些情况没考虑.比其他OJ那种封闭式的好多了.还是进入正题吧. 1.Rotate Image 这个做过两三次了,但每次还是得重新开始推导..这次又推导了很久..不过好在做过,代码也写得比较简洁. 主要思路就是第一层循环按层次深入.第二层把旋转后对应替代的4个位置循环更新.swap就是用来更新用的.做完发现讨论里的最高票代码就是我这样子= =  

leetcode题目:Palindrome Partitioning 和Palindrome Partitioning II

题目一: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = "aab", Return [ ["aa","b"], ["a","a",

leetcode题目:Sum Root to Leaf Numbers和Longest Consecutive Sequence

题目一: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the total sum of all root-to-leaf numbers. For example, 1 /

leetcode题目:Copy List with Random Pointer

题目: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. 思路: 主要是深层复制的问题: 本题比较简单,具体实现见代码: /** * Definition for singly-linked list with a ran

Leetcode题目分类整理

一.数组 8) 双指针 ---- 滑动窗口 例题: 3. Longest Substring Without Repeating Characters 描述:Given a string, find the length of the longest substring without repeating characters. 题解:时间:92.67%,空间:87.02% 1 public int lengthOfLongestSubstring(String s) { 2 // check

【LeetCode】未分类(tag里面没有)(共题)

[419]Battleships in a Board (2018年11月25日)(谷歌的题,没分类.) 给了一个二维平面,上面有 X 和 . 两种字符. 一行或者一列连续的 X 代表一个战舰,问图中有多少个战舰.(题目要求one pass, 空间复杂度是常数) 题目说了每两个战舰之间起码有一个 . 作为分隔符,所以不存在正好交叉的情况. 题解:我提交了一个 floodfill 的题解,能过但是显然不满足要求. discuss里面说,我们可以统计战舰的最上方和最左方,从而来统计战舰的个数.(这个