Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] main from itcharge:main #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 1 commit into AlgorithmAndLeetCode:main from itcharge:main
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Origins/README-Head.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 项目简介

- **「算法与数据结构」** 基础知识的讲解教程,「LeetCode」750+ 道题目的详细解析。本项目易于理解,没有大跨度的思维跳跃,项目中使用部分图示、例子来帮助理解。
- **「算法与数据结构」** 基础知识的讲解教程,「LeetCode」800+ 道题目的详细解析。本项目易于理解,没有大跨度的思维跳跃,项目中使用部分图示、例子来帮助理解。

- 本教程先从基础的数据结构和算法开始讲解,再针对不同分类的数据结构和算法,进行具体题目的讲解分析。让读者可以通过「算法基础理论学习」和「编程实战学习」相结合的方式,彻底的掌握算法知识。

Expand All @@ -26,7 +26,7 @@

我是一名 iOS / macOS 的开发程序员,另外也是北航软院的一名非全硕士(在读)。曾在大学期间学习过算法知识,并参加过 3 年的 ACM 比赛, 但水平有限,未能取得理想成绩。但是这 3 年的 ACM 经历,给我最大的收获是锻炼了自己的逻辑思维和解决实际问题的能力,这种能力为我今后的工作、学习打下了坚实的基础。

我从 2021 年 03 月 30 日开始每日在 LeetCode 刷题,到 2022 年 06 月 08 日已经刷了 1000+ 道题目,并且完成了 750+ 道题解。努力向着 1000+、1500+、2000+ 道题解前进。
我从 2021 年 03 月 30 日开始每日在 LeetCode 刷题,到 2022 年 06 月 08 日已经刷了 1000+ 道题目,并且完成了 800+ 道题解。努力向着 1000+、1500+、2000+ 道题解前进。

在公众号 **「程序员充电站」** 里回复 "**算法打卡**",拉你进 LeetCode 算法打卡计划群一起组队打卡。

Expand Down
4 changes: 2 additions & 2 deletions Assets/Origins/Root-Index-Head.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

**学习数据结构与算法的关键,在于掌握其中的思想和精髓,学会解决实际问题的方法。**

本书采用算法与数据结构相结合的方法,把内容分为如下 `6` 部分:
本书采用算法与数据结构相结合的方法,把内容分为如下 6 部分:

- 第一部分是序言(第 00 章):介绍数据结构与算法的基础知识、算法复杂度、LeetCode 的入门和攻略,为后面的学习打好基础。
- 第二部分是数据结构篇(第 01 ~ 08 章):每一章对应一种数据结构,这个部分用来介绍最常见、最重要的数据结构,以及与该数据结构相关的算法知识。
Expand Down Expand Up @@ -69,7 +69,7 @@

我是一名 iOS / macOS 的开发程序员,另外也是北航软院的一名非全硕士(在读)。曾在大学期间学习过算法知识,并参加过 3 年的 ACM 比赛, 但水平有限,未能取得理想成绩。但是这 3 年的 ACM 经历,给我最大的收获是锻炼了自己的逻辑思维和解决实际问题的能力,这种能力为我今后的工作、学习打下了坚实的基础。

我从 2021 年 03 月 30 日开始每日在 LeetCode 刷题,到 2022 年 06 月 08 日已经刷了 1000+ 道题目,并且完成了 750+ 道题解。努力向着 1000+、1500+、2000+ 道题解前进。
我从 2021 年 03 月 30 日开始每日在 LeetCode 刷题,到 2022 年 06 月 08 日已经刷了 1000+ 道题目,并且完成了 800+ 道题解。努力向着 1000+、1500+、2000+ 道题解前进。

## 版权说明

Expand Down
4 changes: 3 additions & 1 deletion Contents/00.Introduction/04.Solutions-List.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LeetCode 题解(已完成 799 道)
# LeetCode 题解(已完成 801 道)

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------ | :------ | :------ | :------ | :------ |
Expand Down Expand Up @@ -518,6 +518,7 @@
| 1137 | [第 N 个泰波那契数](https://leetcode.cn/problems/n-th-tribonacci-number/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1137.%20%E7%AC%AC%20N%20%E4%B8%AA%E6%B3%B0%E6%B3%A2%E9%82%A3%E5%A5%91%E6%95%B0.md) | 记忆化搜索、数学、动态规划 | 简单 |
| 1143 | [最长公共子序列](https://leetcode.cn/problems/longest-common-subsequence/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1143.%20%E6%9C%80%E9%95%BF%E5%85%AC%E5%85%B1%E5%AD%90%E5%BA%8F%E5%88%97.md) | 字符串、动态规划 | 中等 |
| 1151 | [最少交换次数来组合所有的 1](https://leetcode.cn/problems/minimum-swaps-to-group-all-1s-together/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1151.%20%E6%9C%80%E5%B0%91%E4%BA%A4%E6%8D%A2%E6%AC%A1%E6%95%B0%E6%9D%A5%E7%BB%84%E5%90%88%E6%89%80%E6%9C%89%E7%9A%84%201.md) | 数组、滑动窗口 | 中等 |
| 1155 | [掷骰子等于目标和的方法数](https://leetcode.cn/problems/number-of-dice-rolls-with-target-sum/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1155.%20%E6%8E%B7%E9%AA%B0%E5%AD%90%E7%AD%89%E4%BA%8E%E7%9B%AE%E6%A0%87%E5%92%8C%E7%9A%84%E6%96%B9%E6%B3%95%E6%95%B0.md) | 动态规划 | 中等 |
| 1161 | [最大层内元素和](https://leetcode.cn/problems/maximum-level-sum-of-a-binary-tree/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1161.%20%E6%9C%80%E5%A4%A7%E5%B1%82%E5%86%85%E5%85%83%E7%B4%A0%E5%92%8C.md) | 树、深度优先搜索、广度优先搜索、二叉树 | 中等 |
| 1176 | [健身计划评估](https://leetcode.cn/problems/diet-plan-performance/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1176.%20%E5%81%A5%E8%BA%AB%E8%AE%A1%E5%88%92%E8%AF%84%E4%BC%B0.md) | 数组、滑动窗口 | 简单 |
| 1184 | [公交站间的距离](https://leetcode.cn/problems/distance-between-bus-stops/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1184.%20%E5%85%AC%E4%BA%A4%E7%AB%99%E9%97%B4%E7%9A%84%E8%B7%9D%E7%A6%BB.md) | 数组 | 简单 |
Expand Down Expand Up @@ -600,6 +601,7 @@
| 2376 | [统计特殊整数](https://leetcode.cn/problems/count-special-integers/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2376.%20%E7%BB%9F%E8%AE%A1%E7%89%B9%E6%AE%8A%E6%95%B4%E6%95%B0.md) | 数学、动态规划 | 困难 |
| 2427 | [公因子的数目](https://leetcode.cn/problems/number-of-common-factors/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2427.%20%E5%85%AC%E5%9B%A0%E5%AD%90%E7%9A%84%E6%95%B0%E7%9B%AE.md) | 数学、枚举、数论 | 简单 |
| 2538 | [最大价值和与最小价值和的差值](https://leetcode.cn/problems/difference-between-maximum-and-minimum-price-sum/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2538.%20%E6%9C%80%E5%A4%A7%E4%BB%B7%E5%80%BC%E5%92%8C%E4%B8%8E%E6%9C%80%E5%B0%8F%E4%BB%B7%E5%80%BC%E5%92%8C%E7%9A%84%E5%B7%AE%E5%80%BC.md) | 树、深度优先搜索、数组、动态规划 | 困难 |
| 2585 | [获得分数的方法数](https://leetcode.cn/problems/number-of-ways-to-earn-points/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2585.%20%E8%8E%B7%E5%BE%97%E5%88%86%E6%95%B0%E7%9A%84%E6%96%B9%E6%B3%95%E6%95%B0.md) | 数组、动态规划 | 困难 |
| 2719 | [统计整数数目](https://leetcode.cn/problems/count-of-integers/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2719.%20%E7%BB%9F%E8%AE%A1%E6%95%B4%E6%95%B0%E6%95%B0%E7%9B%AE.md) | 数学、字符串、动态规划 | 困难 |
| 剑指 Offer 03 | [数组中重复的数字](https://leetcode.cn/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/%E5%89%91%E6%8C%87%20Offer%2003.%20%E6%95%B0%E7%BB%84%E4%B8%AD%E9%87%8D%E5%A4%8D%E7%9A%84%E6%95%B0%E5%AD%97.md) | 数组、哈希表、排序 | 简单 |
| 剑指 Offer 04 | [二维数组中的查找](https://leetcode.cn/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/%E5%89%91%E6%8C%87%20Offer%2004.%20%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84%E4%B8%AD%E7%9A%84%E6%9F%A5%E6%89%BE.md) | 数组、二分查找、分治、矩阵 | 中等 |
Expand Down
4 changes: 2 additions & 2 deletions Contents/00.Introduction/05.Categories-List.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------ | :------ | :------ | :------ | :------ |
| 1155 | [掷骰子等于目标和的方法数](https://leetcode.cn/problems/number-of-dice-rolls-with-target-sum/) | | 动态规划 | 中等 |
| 2585 | [获得分数的方法数](https://leetcode.cn/problems/number-of-ways-to-earn-points/) | | 数组、动态规划 | 困难 |
| 1155 | [掷骰子等于目标和的方法数](https://leetcode.cn/problems/number-of-dice-rolls-with-target-sum/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1155.%20%E6%8E%B7%E9%AA%B0%E5%AD%90%E7%AD%89%E4%BA%8E%E7%9B%AE%E6%A0%87%E5%92%8C%E7%9A%84%E6%96%B9%E6%B3%95%E6%95%B0.md) | 动态规划 | 中等 |
| 2585 | [获得分数的方法数](https://leetcode.cn/problems/number-of-ways-to-earn-points/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2585.%20%E8%8E%B7%E5%BE%97%E5%88%86%E6%95%B0%E7%9A%84%E6%96%B9%E6%B3%95%E6%95%B0.md) | 数组、动态规划 | 困难 |

#### 多维背包问题

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------ | :------ | :------ | :------ | :------ |
| 1155 | [掷骰子等于目标和的方法数](https://leetcode.cn/problems/number-of-dice-rolls-with-target-sum/) | | 动态规划 | 中等 |
| 2585 | [获得分数的方法数](https://leetcode.cn/problems/number-of-ways-to-earn-points/) | | 数组、动态规划 | 困难 |
| 1155 | [掷骰子等于目标和的方法数](https://leetcode.cn/problems/number-of-dice-rolls-with-target-sum/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/1155.%20%E6%8E%B7%E9%AA%B0%E5%AD%90%E7%AD%89%E4%BA%8E%E7%9B%AE%E6%A0%87%E5%92%8C%E7%9A%84%E6%96%B9%E6%B3%95%E6%95%B0.md) | 动态规划 | 中等 |
| 2585 | [获得分数的方法数](https://leetcode.cn/problems/number-of-ways-to-earn-points/) | [Python](https://github.com/itcharge/LeetCode-Py/blob/main/Solutions/2585.%20%E8%8E%B7%E5%BE%97%E5%88%86%E6%95%B0%E7%9A%84%E6%96%B9%E6%B3%95%E6%95%B0.md) | 数组、动态规划 | 困难 |

#### 多维背包问题

Expand Down
6 changes: 3 additions & 3 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 项目简介

- **「算法与数据结构」** 基础知识的讲解教程,「LeetCode」750+ 道题目的详细解析。本项目易于理解,没有大跨度的思维跳跃,项目中使用部分图示、例子来帮助理解。
- **「算法与数据结构」** 基础知识的讲解教程,「LeetCode」800+ 道题目的详细解析。本项目易于理解,没有大跨度的思维跳跃,项目中使用部分图示、例子来帮助理解。

- 本教程先从基础的数据结构和算法开始讲解,再针对不同分类的数据结构和算法,进行具体题目的讲解分析。让读者可以通过「算法基础理论学习」和「编程实战学习」相结合的方式,彻底的掌握算法知识。

Expand All @@ -26,7 +26,7 @@

我是一名 iOS / macOS 的开发程序员,另外也是北航软院的一名非全硕士(在读)。曾在大学期间学习过算法知识,并参加过 3 年的 ACM 比赛, 但水平有限,未能取得理想成绩。但是这 3 年的 ACM 经历,给我最大的收获是锻炼了自己的逻辑思维和解决实际问题的能力,这种能力为我今后的工作、学习打下了坚实的基础。

我从 2021 年 03 月 30 日开始每日在 LeetCode 刷题,到 2022 年 06 月 08 日已经刷了 1000+ 道题目,并且完成了 750+ 道题解。努力向着 1000+、1500+、2000+ 道题解前进。
我从 2021 年 03 月 30 日开始每日在 LeetCode 刷题,到 2022 年 06 月 08 日已经刷了 1000+ 道题目,并且完成了 800+ 道题解。努力向着 1000+、1500+、2000+ 道题解前进。

在公众号 **「程序员充电站」** 里回复 "**算法打卡**",拉你进 LeetCode 算法打卡计划群一起组队打卡。

Expand Down Expand Up @@ -259,4 +259,4 @@
- [动态规划优化题目](./Contents/10.Dynamic-Programming/11.DP-Optimization/04.DP-Optimization-List.md)

## 11. 附加内容
## [12. LeetCode 题解(已完成 799 道)](./Contents/00.Introduction/04.Solutions-List.md)
## [12. LeetCode 题解(已完成 801 道)](./Contents/00.Introduction/04.Solutions-List.md)
67 changes: 61 additions & 6 deletions Solutions/0063. 不同路径 II.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,68 @@

## 题目大意

一个机器人位于一个 `m x n` 网格的左上角。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角。但是网格中有障碍物,不能通过。
**描述**:一个机器人位于一个 $m \times n$ 网格的左上角。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角。但是网格中有障碍物,不能通过。

现在给定一个二维数组表示网格,1 代表障碍物,0 表示空位。要求计算出:从左上角到右下角会有多少条不同的路径。
现在给定一个二维数组表示网格,1ドル$ 代表障碍物,0ドル$ 表示空位。

**要求**:计算出从左上角到右下角会有多少条不同的路径。

**说明**:

- $m == obstacleGrid.length$。
- $n == obstacleGrid[i].length$。
- 1ドル \le m, n \le 100$。
- $obstacleGrid[i][j]$ 为 0ドル$ 或 1ドル$。

**示例**:

- 示例 1:

![](https://assets.leetcode.com/uploads/2020/11/04/robot1.jpg)

```Python
输入:obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]
输出:2
解释:3x3 网格的正中间有一个障碍物。
从左上角到右下角一共有 2 条不同的路径:
1. 向右 -> 向右 -> 向下 -> 向下
2. 向下 -> 向下 -> 向右 -> 向右
```

- 示例 2:

![](https://assets.leetcode.com/uploads/2020/11/04/robot2.jpg)

```Python
输入:obstacleGrid = [[0,1],[0,0]]
输出:1
```

## 解题思路

可以用动态规划求解,设 `dp[i][j]` 是从 `(0, 0)` 到 `(i, j)` 的不同路径数。显然 `dp[i][j] = dp[i-1][j] + dp[i][j-1]`。对于第一行、第一列,因为只能超一个方向走,所以 `dp[i][0] = 1`,`dp[0][j] = 1`。如果在第一行、第一列遇到障碍,则终止赋值,跳出循环。
### 思路 1:动态规划

###### 1. 划分阶段

按照路径的结尾位置(行位置、列位置组成的二维坐标)进行阶段划分。

###### 2. 定义状态

定义状态 $dp[i][j]$ 表示为:从 $(0, 0)$ 到 $(i, j)$ 的不同路径数。

###### 3. 状态转移方程

因为我们每次只能向右、或者向下移动一步,因此想要走到 $(i, j),ドル只能从 $(i - 1, j)$ 向下走一步走过来;或者从 $(i, j - 1)$ 向右走一步走过来。则状态转移方程为:$dp[i][j] = dp[i - 1][j] + dp[i][j - 1],ドル其中 $obstacleGrid[i][j] == 0$。

然后从上到下,从左到右依次遍历,递推求解,遇到障碍物就跳过。最终输出 `dp[m - 1][n - 1]` 即可。
###### 4. 初始条件

## 代码
- 对于第一行、第一列,因为只能超一个方向走,所以 $dp[i][0] = 1,ドル$dp[0][j] = 1$。如果在第一行、第一列遇到障碍,则终止赋值,跳出循环。

###### 5. 最终结果

根据我们之前定义的状态,$dp[i][j]$ 表示为:从 $(0, 0)$ 到 $(i, j)$ 的不同路径数。所以最终结果为 $dp[m - 1][n - 1]$。

### 思路 1:代码

```Python
class Solution:
Expand All @@ -40,6 +91,10 @@ class Solution:
continue
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[m - 1][n - 1]

```

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

- **时间复杂度**:$O(m \times n)$。
- **空间复杂度**:$O(m \times n)$。

70 changes: 59 additions & 11 deletions Solutions/0474. 一和零.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,71 @@

## 题目大意

给定一个二进制字符串数组 `strs`,以及两个整数 `m``n`
**描述**:给定一个二进制字符串数组 $strs$,以及两个整数 $m$$n$

要求:找出并返回 `strs` 的最大子集大小,该子集中最多有 `m`0`n`1
**要求**:找出并返回 $strs$ 的最大子集的大小,该子集中最多有 $m$0ドル$$n$1ドル$

如果 `x` 的所有元素也是 `y` 的元素,集合 `x` 是集合 `y` 的子集。
**说明**:

- 如果 $x$ 的所有元素也是 $y$ 的元素,集合 $x$ 是集合 $y$ 的子集。
- 1ドル \le strs.length \le 600$。
- 1ドル \le strs[i].length \le 100$。
- $strs[i]$ 仅由 `'0'` 和 `'1'` 组成。
- 1ドル \le m, n \le 100$。

**示例**:

- 示例 1:

```Python
输入:strs = ["10", "0001", "111001", "1", "0"], m = 5, n = 3
输出:4
解释:最多有 5 个 0 和 3 个 1 的最大子集是 {"10","0001","1","0"} ,因此答案是 4 。
其他满足题意但较小的子集包括 {"0001","1"} 和 {"10","1","0"} 。{"111001"} 不满足题意,因为它含 4 个 1 ,大于 n 的值 3。
```

- 示例 2:

```Python
输入:strs = ["10", "0", "1"], m = 1, n = 1
输出:2
解释:最大的子集是 {"0", "1"} ,所以答案是 2。
```

## 解题思路

可以转换为 0-1 背包问题来做。
### 思路 1:动态规划

这道题可以转换为「二维 0-1 背包问题」来做。

`0` 的个数和 `1 ` 的个数视作一个二维背包的容量。每一个字符串都当做是一件物品,其成本为字符串中 `1` 的数量和 `0` 的数量,每个字符串的价值为 1
0ドル$ 的个数和 1ドル$ 的个数视作一个二维背包的容量。每一个字符串都当做是一件物品,其成本为字符串中 1ドル$ 的数量和 0ドル$ 的数量,每个字符串的价值为 1ドル$

则可以定义状态 `dp[i][j]` 为:最多有 `i` 个 `0` 和 `j` 个 `1` 的字符串 `strs` 的最大子集的大小为 `dp[i][j]`。
###### 1. 划分阶段

则递推公式为:`dp[i][j] = max(dp[i][j], dp[i - zero_num][j - one_num] + 1)`
按照物品的序号、当前背包的载重上限进行阶段划分

意思为:填满由 `i` 个 `0` 和 `j` 个 `1 ` 构成的二维背包的最多物品数为下面两种情况中的最大值:
###### 2. 定义状态

- 使用之前字符串填满容量为 `i - zero_num`、`j - one_num` 的背包的物品数 + 当前字符串价值
- 选择之前字符串填满容量为 `i`、`j` 的物品数。
定义状态 $dp[i][j]$ 表示为:最多有 $i$ 个 0ドル$ 和 $j$ 个 1ドル$ 的字符串 $strs$ 的最大子集的大小。

## 代码
###### 3. 状态转移方程

填满最多由 $i$ 个 0ドル$ 和 $j$ 个 1ドル$ 构成的二维背包的最多物品数为下面两种情况中的最大值:

- 使用之前字符串填满容量为 $i - zero\underline{}num$、$j - one\underline{}num$ 的背包的物品数 + 当前字符串价值
- 选择之前字符串填满容量为 $i$、$j$ 的物品数。

则状态转移方程为:$dp[i][j] = max(dp[i][j], dp[i - zero\underline{}num][j - one\underline{}num] + 1)$。

###### 4. 初始条件

- 无论有多少个 0ドル,ドル多少个 1ドル,ドル只要不选 0ドル,ドル也不选 1ドル,ドル则最大子集的大小为 0ドル$。

###### 5. 最终结果

根据我们之前定义的状态,$dp[i][j]$ 表示为:最多有 $i$ 个 0ドル$ 和 $j$ 个 1ドル$ 的字符串 $strs$ 的最大子集的大小。所以最终结果为 $dp[m][n]$。

### 思路 1:代码

```Python
class Solution:
Expand All @@ -48,3 +91,8 @@ class Solution:
return dp[m][n]
```

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

- **时间复杂度**:$O(l \times m \times n),ドル其中 $l$ 为字符串 $strs$ 的长度。
- **空间复杂度**:$O(m \times n)$。

Loading

AltStyle によって変換されたページ (->オリジナル) /