跳至主要內容

04. LeetCode 题解(字典序排序)

ITCharge大约 94 分钟

LeetCode 题解(已完成 859 道)

题号标题题解标签难度
0001两数之和open in new windowPythonopen in new window数组、哈希表简单
0002两数相加open in new windowPythonopen in new window递归、链表、数学中等
0003无重复字符的最长子串open in new windowPythonopen in new window哈希表、字符串、滑动窗口中等
0004寻找两个正序数组的中位数open in new windowPythonopen in new window数组、二分查找、分治困难
0005最长回文子串open in new windowPythonopen in new window字符串、动态规划中等
0007整数反转open in new windowPythonopen in new window数学中等
0008字符串转换整数 (atoi)open in new windowPythonopen in new window字符串中等
0009回文数open in new windowPythonopen in new window数学简单
0010正则表达式匹配open in new windowPythonopen in new window递归、字符串、动态规划困难
0011盛最多水的容器open in new windowPythonopen in new window贪心、数组、双指针中等
0012整数转罗马数字open in new windowPythonopen in new window哈希表、数学、字符串中等
0013罗马数字转整数open in new windowPythonopen in new window哈希表、数学、字符串简单
0014最长公共前缀open in new windowPythonopen in new window字典树、字符串简单
0015三数之和open in new windowPythonopen in new window数组、双指针、排序中等
0016最接近的三数之和open in new windowPythonopen in new window数组、双指针、排序中等
0017电话号码的字母组合open in new windowPythonopen in new window哈希表、字符串、回溯中等
0018四数之和open in new windowPythonopen in new window数组、双指针、排序中等
0019删除链表的倒数第 N 个结点open in new windowPythonopen in new window链表、双指针中等
0020有效的括号open in new windowPythonopen in new window栈、字符串简单
0021合并两个有序链表open in new windowPythonopen in new window递归、链表简单
0022括号生成open in new windowPythonopen in new window字符串、动态规划、回溯中等
0023合并 K 个升序链表open in new windowPythonopen in new window链表、分治、堆(优先队列)、归并排序困难
0024两两交换链表中的节点open in new windowPythonopen in new window递归、链表中等
0025K 个一组翻转链表open in new windowPythonopen in new window递归、链表困难
0026删除有序数组中的重复项open in new windowPythonopen in new window数组、双指针简单
0027移除元素open in new windowPythonopen in new window数组、双指针简单
0028找出字符串中第一个匹配项的下标open in new windowPythonopen in new window双指针、字符串、字符串匹配中等
0029两数相除open in new windowPythonopen in new window位运算、数学中等
0032最长有效括号open in new windowPythonopen in new window栈、字符串、动态规划困难
0033搜索旋转排序数组open in new windowPythonopen in new window数组、二分查找中等
0034在排序数组中查找元素的第一个和最后一个位置open in new windowPythonopen in new window数组、二分查找中等
0035搜索插入位置open in new windowPythonopen in new window数组、二分查找简单
0036有效的数独open in new windowPythonopen in new window数组、哈希表、矩阵中等
0037解数独open in new windowPythonopen in new window数组、哈希表、回溯、矩阵困难
0038外观数列open in new windowPythonopen in new window字符串中等
0039组合总和open in new windowPythonopen in new window数组、回溯中等
0040组合总和 IIopen in new windowPythonopen in new window数组、回溯中等
0041缺失的第一个正数open in new windowPythonopen in new window数组、哈希表困难
0042接雨水open in new windowPythonopen in new window栈、数组、双指针、动态规划、单调栈困难
0043字符串相乘open in new windowPythonopen in new window数学、字符串、模拟中等
0044通配符匹配open in new windowPythonopen in new window贪心、递归、字符串、动态规划困难
0045跳跃游戏 IIopen in new windowPythonopen in new window贪心、数组、动态规划中等
0046全排列open in new windowPythonopen in new window数组、回溯中等
0047全排列 IIopen in new windowPythonopen in new window数组、回溯中等
0048旋转图像open in new windowPythonopen in new window数组、数学、矩阵中等
0049字母异位词分组open in new windowPythonopen in new window数组、哈希表、字符串、排序中等
0050Pow(x, n)open in new windowPythonopen in new window递归、数学中等
0051N 皇后open in new windowPythonopen in new window数组、回溯困难
0052N 皇后 IIopen in new windowPythonopen in new window回溯困难
0053最大子数组和open in new windowPythonopen in new window数组、分治、动态规划中等
0054螺旋矩阵open in new windowPythonopen in new window数组、矩阵、模拟中等
0055跳跃游戏open in new windowPythonopen in new window贪心、数组、动态规划中等
0056合并区间open in new windowPythonopen in new window数组、排序中等
0058最后一个单词的长度open in new windowPythonopen in new window字符串简单
0059螺旋矩阵 IIopen in new windowPythonopen in new window数组、矩阵、模拟中等
0061旋转链表open in new windowPythonopen in new window链表、双指针中等
0062不同路径open in new windowPythonopen in new window数学、动态规划、组合数学中等
0063不同路径 IIopen in new windowPythonopen in new window数组、动态规划、矩阵中等
0064最小路径和open in new windowPythonopen in new window数组、动态规划、矩阵中等
0066加一open in new windowPythonopen in new window数组、数学简单
0067二进制求和open in new windowPythonopen in new window位运算、数学、字符串、模拟简单
0069x 的平方根open in new windowPythonopen in new window数学、二分查找简单
0070爬楼梯open in new windowPythonopen in new window记忆化搜索、数学、动态规划简单
0072编辑距离open in new windowPythonopen in new window字符串、动态规划困难
0073矩阵置零open in new windowPythonopen in new window数组、哈希表、矩阵中等
0074搜索二维矩阵open in new windowPythonopen in new window数组、二分查找、矩阵中等
0075颜色分类open in new windowPythonopen in new window数组、双指针、排序中等
0076最小覆盖子串open in new windowPythonopen in new window哈希表、字符串、滑动窗口困难
0077组合open in new windowPythonopen in new window回溯中等
0078子集open in new windowPythonopen in new window位运算、数组、回溯中等
0079单词搜索open in new windowPythonopen in new window数组、回溯、矩阵中等
0080删除有序数组中的重复项 IIopen in new windowPythonopen in new window数组、双指针中等
0081搜索旋转排序数组 IIopen in new windowPythonopen in new window数组、二分查找中等
0082删除排序链表中的重复元素 IIopen in new windowPythonopen in new window链表、双指针中等
0083删除排序链表中的重复元素open in new windowPythonopen in new window链表简单
0084柱状图中最大的矩形open in new windowPythonopen in new window栈、数组、单调栈困难
0088合并两个有序数组open in new windowPythonopen in new window数组、双指针、排序简单
0089格雷编码open in new windowPythonopen in new window位运算、数学、回溯中等
0090子集 IIopen in new windowPythonopen in new window位运算、数组、回溯中等
0091解码方法open in new windowPythonopen in new window字符串、动态规划中等
0092反转链表 IIopen in new windowPythonopen in new window链表中等
0093复原 IP 地址open in new windowPythonopen in new window字符串、回溯中等
0094二叉树的中序遍历open in new windowPythonopen in new window栈、树、深度优先搜索、二叉树简单
0095不同的二叉搜索树 IIopen in new windowPythonopen in new window树、二叉搜索树、动态规划、回溯、二叉树中等
0096不同的二叉搜索树open in new windowPythonopen in new window树、二叉搜索树、数学、动态规划、二叉树中等
0098验证二叉搜索树open in new windowPythonopen in new window树、深度优先搜索、二叉搜索树、二叉树中等
0100相同的树open in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、二叉树简单
0101对称二叉树open in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、二叉树简单
0102二叉树的层序遍历open in new windowPythonopen in new window树、广度优先搜索、二叉树中等
0103二叉树的锯齿形层序遍历open in new windowPythonopen in new window树、广度优先搜索、二叉树中等
0104二叉树的最大深度open in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、二叉树简单
0105从前序与中序遍历序列构造二叉树open in new windowPythonopen in new window树、数组、哈希表、分治、二叉树中等
0106从中序与后序遍历序列构造二叉树open in new windowPythonopen in new window树、数组、哈希表、分治、二叉树中等
0107二叉树的层序遍历 IIopen in new windowPythonopen in new window树、广度优先搜索、二叉树中等
0108将有序数组转换为二叉搜索树open in new windowPythonopen in new window树、二叉搜索树、数组、分治、二叉树简单
0110平衡二叉树open in new windowPythonopen in new window树、深度优先搜索、二叉树简单
0111二叉树的最小深度open in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、二叉树简单
0112路径总和open in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、二叉树简单
0113路径总和 IIopen in new windowPythonopen in new window树、深度优先搜索、回溯、二叉树中等
0115不同的子序列open in new windowPythonopen in new window字符串、动态规划困难
0116填充每个节点的下一个右侧节点指针open in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、链表、二叉树中等
0117填充每个节点的下一个右侧节点指针 IIopen in new windowPythonopen in new window树、深度优先搜索、广度优先搜索、链表、二叉树中等
0118杨辉三角open in new windowPythonopen in new window数组、动态规划简单
0119杨辉三角 IIopen in new windowPythonopen in new window数组、动态规划简单
0120三角形最小路径和open in new windowPythonopen in new window数组、动态规划中等
0121买卖股票的最佳时机open in new windowPythonopen in new window数组、动态规划简单
0122买卖股票的最佳时机 IIopen in new windowPythonopen in new window贪心、数组中等
0123买卖股票的最佳时机 IIIopen in new windowPythonopen in new window数组、动态规划困难
0124二叉树中的最大路径和open in new windowPythonopen in new window树、深度优先搜索、动态规划、二叉树困难
0125验证回文串open in new windowPythonopen in new window双指针、字符串简单
0127单词接龙open in new windowPythonopen in new window广度优先搜索、哈希表、字符串困难
0128最长连续序列open in new windowPythonopen in new window并查集、数组、哈希表中等
0129求根节点到叶节点数字之和open in new windowPythonopen in new window树、深度优先搜索、二叉树中等
0130被围绕的区域open in new windowPythonopen in new window深度优先搜索、广度优先搜索、并查集、数组、矩阵中等
0131分割回文串open in new windowPythonopen in new window字符串、动态规划、回溯中等
0133克隆图open in new windowPythonopen in new window深度优先搜索、广度优先搜索、图、哈希表中等
0134加油站open in new windowPythonopen in new window贪心、数组中等
0135分发糖果open in new windowPythonopen in new window贪心、数组困难
0136只出现一次的数字open in new windowPythonopen in new window位运算、数组简单
0137只出现一次的数字 IIopen in new windowPythonopen in new window位运算、数组中等
0138复制带随机指针的链表open in new windowPythonopen in new window哈希表、链表中等
0139单词拆分open in new windowPythonopen in new window字典树、记忆化搜索、数组、哈希表、字符串、动态规划中等
0140单词拆分 IIopen in new windowPythonopen in new window字典树、记忆化搜索、数组、哈希表、字符串、动态规划、回溯困难
0141环形链表open in new windowPythonopen in new window哈希表、链表、双指针简单
0142环形链表 IIopen in new windowPythonopen in new window哈希表、链表、双指针中等
0143重排链表open in new windowPythonopen in new window栈、递归、链表、双指针中等
0144二叉树的前序遍历open in new windowPythonopen in new window栈、树、深度优先搜索、二叉树简单
0145二叉树的后序遍历open in new windowPythonopen in new window栈、树、深度优先搜索、二叉树简单
0147对链表进行插入排序open in new windowPythonopen in new window链表、排序中等
0148排序链表open in new windowPythonopen in new window链表、双指针、分治、排序、归并排序中等
0149直线上最多的点数open in new windowPythonopen in new window几何、数组、哈希表、数学困难
0150逆波兰表达式求值open in new windowPythonopen in new window栈、数组、数学中等
0151反转字符串中的单词open in new windowPythonopen in new window双指针、字符串中等
0152乘积最大子数组open in new windowPythonopen in new window数组、动态规划中等
0153寻找旋转排序数组中的最小值open in new windowPythonopen in new window数组、二分查找中等
0154寻找旋转排序数组中的最小值 IIopen in new windowPythonopen in new window数组、二分查找困难
0155最小栈open in new windowPythonopen in new window栈、设计中等
0159至多包含两个不同字符的最长子串open in new windowPythonopen in new window哈希表、字符串、滑动窗口中等
0160相交链表open in new windowPythonopen in new window哈希表、链表、双指针简单
0162寻找峰值open in new windowPythonopen in new window数组、二分查找中等
0164最大间距open in new windowPythonopen in new window数组、桶排序、基数排序、排序困难
0166分数到小数open in new windowPythonopen in new window哈希表、数学、字符串中等
0167两数之和 II - 输入有序