Skip to content

Commit

Permalink
更新题解列表
Browse files Browse the repository at this point in the history
  • Loading branch information
itcharge committed Dec 26, 2023
1 parent 3af2fcd commit 478ff99
Show file tree
Hide file tree
Showing 825 changed files with 3,305 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Solutions/0001. 两数之和.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、哈希表
- 难度:简单

## 题目链接

- [0001. 两数之和 - 力扣](https://leetcode.cn/problems/two-sum/)

## 题目大意

**描述**:给定一个整数数组 $nums$ 和一个整数目标值 $target$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0002. 两数相加.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:递归、链表、数学
- 难度:中等

## 题目链接

- [0002. 两数相加 - 力扣](https://leetcode.cn/problems/add-two-numbers/)

## 题目大意

**描述**:给定两个非空的链表 `l1``l2`。分别用来表示两个非负整数,每位数字都是按照逆序的方式存储的,每个节点存储一位数字。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0003. 无重复字符的最长子串.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:哈希表、字符串、滑动窗口
- 难度:中等

## 题目链接

- [0003. 无重复字符的最长子串 - 力扣](https://leetcode.cn/problems/longest-substring-without-repeating-characters/)

## 题目大意

**描述**:给定一个字符串 $s$。
Expand Down
6 changes: 5 additions & 1 deletion Solutions/0004. 寻找两个正序数组的中位数.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、二分查找、分治
- 难度:困难

## 题目链接

- [0004. 寻找两个正序数组的中位数 - 力扣](https://leetcode.cn/problems/median-of-two-sorted-arrays/)

## 题目大意

**描述**:给定两个正序(从小到大排序)数组 $nums1$、$nums2$。
Expand Down Expand Up @@ -120,5 +124,5 @@ class Solution:

### 思路 1:复杂度分析

- **时间复杂度**:$O(\log_2 (m + n))$ 。
- **时间复杂度**:$O(\log (m + n))$ 。
- **空间复杂度**:$O(1)$。
4 changes: 4 additions & 0 deletions Solutions/0005. 最长回文子串.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:字符串、动态规划
- 难度:中等

## 题目链接

- [0005. 最长回文子串 - 力扣](https://leetcode.cn/problems/longest-palindromic-substring/)

## 题目大意

**描述**:给定一个字符串 $s$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0007. 整数反转.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数学
- 难度:中等

## 题目链接

- [0007. 整数反转 - 力扣](https://leetcode.cn/problems/reverse-integer/)

## 题目大意

给定一个 32 位有符号整数 x,将 x 进行反转。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0008. 字符串转换整数 (atoi).md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:字符串
- 难度:中等

## 题目链接

- [0008. 字符串转换整数 (atoi) - 力扣](https://leetcode.cn/problems/string-to-integer-atoi/)

## 题目大意

**描述**:给定一个字符串 `s`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0009. 回文数.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数学
- 难度:简单

## 题目链接

- [0009. 回文数 - 力扣](https://leetcode.cn/problems/palindrome-number/)

## 题目大意

给定整数 x,判断 x 是否是回文数。要求不能用整数转为字符串的方式来解决这个问题。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0010. 正则表达式匹配.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:递归、字符串、动态规划
- 难度:困难

## 题目链接

- [0010. 正则表达式匹配 - 力扣](https://leetcode.cn/problems/regular-expression-matching/)

## 题目大意

**描述**:给定一个字符串 `s` 和一个字符模式串 `p`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0011. 盛最多水的容器.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:贪心、数组、双指针
- 难度:中等

## 题目链接

- [0011. 盛最多水的容器 - 力扣](https://leetcode.cn/problems/container-with-most-water/)

## 题目大意

**描述**:给定 $n$ 个非负整数 $a_1,a_2, ...,a_n$,每个数代表坐标中的一个点 $(i, a_i)$。在坐标内画 $n$ 条垂直线,垂直线 $i$ 的两个端点分别为 $(i, a_i)$ 和 $(i, 0)$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0012. 整数转罗马数字.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:哈希表、数学、字符串
- 难度:中等

## 题目链接

- [0012. 整数转罗马数字 - 力扣](https://leetcode.cn/problems/integer-to-roman/)

## 题目大意

给定一个整数,将其转换为罗马数字。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0013. 罗马数字转整数.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:哈希表、数学、字符串
- 难度:简单

## 题目链接

- [0013. 罗马数字转整数 - 力扣](https://leetcode.cn/problems/roman-to-integer/)

## 题目大意

给定一个罗马数字对应的字符串,将其转换为整数。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0014. 最长公共前缀.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:字典树、字符串
- 难度:简单

## 题目链接

- [0014. 最长公共前缀 - 力扣](https://leetcode.cn/problems/longest-common-prefix/)

## 题目大意

**描述**:给定一个字符串数组 `strs`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0015. 三数之和.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、双指针、排序
- 难度:中等

## 题目链接

- [0015. 三数之和 - 力扣](https://leetcode.cn/problems/3sum/)

## 题目大意

**描述**:给定一个整数数组 $nums$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0016. 最接近的三数之和.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、双指针、排序
- 难度:中等

## 题目链接

- [0016. 最接近的三数之和 - 力扣](https://leetcode.cn/problems/3sum-closest/)

## 题目大意

给你一个整数数组 `nums` 和 一个目标值 `target`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0017. 电话号码的字母组合.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:哈希表、字符串、回溯
- 难度:中等

## 题目链接

- [0017. 电话号码的字母组合 - 力扣](https://leetcode.cn/problems/letter-combinations-of-a-phone-number/)

## 题目大意

**描述**:给定一个只包含数字 2~9 的字符串 `digits`。给出数字到字母的映射如下(与电话按键相同)。注意 $1$ 不对应任何字母。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0018. 四数之和.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、双指针、排序
- 难度:中等

## 题目链接

- [0018. 四数之和 - 力扣](https://leetcode.cn/problems/4sum/)

## 题目大意

**描述**:给定一个整数数组 $nums$ 和一个目标值 $target$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0019. 删除链表的倒数第 N 个结点.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:链表、双指针
- 难度:中等

## 题目链接

- [0019. 删除链表的倒数第 N 个结点 - 力扣](https://leetcode.cn/problems/remove-nth-node-from-end-of-list/)

## 题目大意

**描述**:给定一个链表的头节点 `head`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0020. 有效的括号.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:栈、字符串
- 难度:简单

## 题目链接

- [0020. 有效的括号 - 力扣](https://leetcode.cn/problems/valid-parentheses/)

## 题目大意

**描述**:给定一个只包括 `'('``')'``'{'``'}'``'['``']'` 的字符串 `s`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0021. 合并两个有序链表.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:递归、链表
- 难度:简单

## 题目链接

- [0021. 合并两个有序链表 - 力扣](https://leetcode.cn/problems/merge-two-sorted-lists/)

## 题目大意

**描述**:给定两个升序链表的头节点 `list1``list2`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0022. 括号生成.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:字符串、回溯算法
- 难度:中等

## 题目链接

- [0022. 括号生成 - 力扣](https://leetcode.cn/problems/generate-parentheses/)

## 题目大意

**描述**:给定一个整数 $n$,代表生成括号的对数。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0023. 合并 K 个升序链表.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:链表、分治、堆(优先队列)、归并排序
- 难度:困难

## 题目链接

- [0023. 合并 K 个升序链表 - 力扣](https://leetcode.cn/problems/merge-k-sorted-lists/)

## 题目大意

**描述**:给定一个链表数组,每个链表都已经按照升序排列。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0024. 两两交换链表中的节点.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:递归、链表
- 难度:中等

## 题目链接

- [0024. 两两交换链表中的节点 - 力扣](https://leetcode.cn/problems/swap-nodes-in-pairs/)

## 题目大意

**描述**:给定一个链表的头节点 `head`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0025. K 个一组翻转链表.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:递归、链表
- 难度:困难

## 题目链接

- [0025. K 个一组翻转链表 - 力扣](https://leetcode.cn/problems/reverse-nodes-in-k-group/)

## 题目大意

**描述**:给你链表的头节点 `head` ,再给定一个正整数 `k``k` 的值小于或等于链表的长度。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0026. 删除有序数组中的重复项.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、双指针
- 难度:简单

## 题目链接

- [0026. 删除有序数组中的重复项 - 力扣](https://leetcode.cn/problems/remove-duplicates-from-sorted-array/)

## 题目大意

**描述**:给定一个有序数组 `nums`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0027. 移除元素.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、双指针
- 难度:简单

## 题目链接

- [0027. 移除元素 - 力扣](https://leetcode.cn/problems/remove-element/)

## 题目大意

**描述**:给定一个数组 $nums$,和一个值 $val$。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:双指针、字符串、字符串匹配
- 难度:中等

## 题目链接

- [0028. 找出字符串中第一个匹配项的下标 - 力扣](https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string/)

## 题目大意

**描述**:给定两个字符串 `haystack``needle`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0029. 两数相除.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:位运算、数学
- 难度:中等

## 题目链接

- [0029. 两数相除 - 力扣](https://leetcode.cn/problems/divide-two-integers/)

## 题目大意

给定两个整数,被除数 dividend 和除数 divisor。要求返回两数相除的商,并且不能使用乘法,除法和取余运算。取值范围在 $[-2^{31}, 2^{31}-1]$。如果结果溢出,则返回 $2^{31} - 1$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0032. 最长有效括号.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:栈、字符串、动态规划
- 难度:困难

## 题目链接

- [0032. 最长有效括号 - 力扣](https://leetcode.cn/problems/longest-valid-parentheses/)

## 题目大意

**描述**:给定一个只包含 `'('``')'` 的字符串。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0033. 搜索旋转排序数组.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、二分查找
- 难度:中等

## 题目链接

- [0033. 搜索旋转排序数组 - 力扣](https://leetcode.cn/problems/search-in-rotated-sorted-array/)

## 题目大意

**描述**:给定一个整数数组 $nums$,数组中值互不相同。给定的 $nums$ 是经过升序排列后的又进行了「旋转」操作的。再给定一个整数 $target$。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、二分查找
- 难度:中等

## 题目链接

- [0034. 在排序数组中查找元素的第一个和最后一个位置 - 力扣](https://leetcode.cn/problems/find-first-and-last-position-of-element-in-sorted-array/)

## 题目大意

**描述**:给你一个按照非递减顺序排列的整数数组 `nums`,和一个目标值 `target`
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0035. 搜索插入位置.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、二分查找
- 难度:简单

## 题目链接

- [0035. 搜索插入位置 - 力扣](https://leetcode.cn/problems/search-insert-position/)

## 题目大意

**描述**:给定一个排好序的数组 $nums$,以及一个目标值 $target$。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0036. 有效的数独.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、哈希表、矩阵
- 难度:中等

## 题目链接

- [0036. 有效的数独 - 力扣](https://leetcode.cn/problems/valid-sudoku/)

## 题目大意

**描述**:给定一个数独,用 `9 * 9` 的二维字符数组 `board` 来表示,其中,未填入的空白用 "." 代替。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0037. 解数独.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:数组、哈希表、回溯、矩阵
- 难度:困难

## 题目链接

- [0037. 解数独 - 力扣](https://leetcode.cn/problems/sudoku-solver/)

## 题目大意

**描述**:给定一个二维的字符数组 $board$ 用来表示数独,其中数字 $1 \sim 9$ 表示该位置已经填入了数字,`.` 表示该位置还没有填入数字。
Expand Down
4 changes: 4 additions & 0 deletions Solutions/0038. 外观数列.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- 标签:字符串
- 难度:中等

## 题目链接

- [0038. 外观数列 - 力扣](https://leetcode.cn/problems/count-and-say/)

## 题目大意

给定一个正整数 n,$(1 \le n \le 30)$,要求输出外观数列的第 n 项。
Expand Down
Loading

0 comments on commit 478ff99

Please sign in to comment.