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

Commit 4900978

Browse files
✨feat: add 113、1691、1697、1780
1 parent be35c5c commit 4900978

13 files changed

+482
-9
lines changed

‎Index/DFS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| [40. 组合总和 II](https://leetcode-cn.com/problems/combination-sum-ii/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/combination-sum-ii/solution/dfs-hui-su-jie-fa-yi-ji-ru-he-pan-duan-s-xlwy/) | 中等 | 🤩🤩🤩🤩 |
88
| [93. 复原 IP 地址](https://leetcode.cn/problems/restore-ip-addresses/) | [LeetCode 题解链接](https://acoier.com/2022/12/09/93.%20%E5%A4%8D%E5%8E%9F%20IP%20%E5%9C%B0%E5%9D%80%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩 |
99
| [95. 不同的二叉搜索树 II](https://leetcode.cn/problems/unique-binary-search-trees-ii/) | [LeetCode 题解链接](https://www.acoier.com/2022/12/09/95.%20%E4%B8%8D%E5%90%8C%E7%9A%84%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%20II%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩🤩 |
10+
| [113. 路径总和 II](https://leetcode.cn/problems/path-sum-ii/) | [LeetCode 题解链接](https://acoier.com/2022/12/10/113.%20%E8%B7%AF%E5%BE%84%E6%80%BB%E5%92%8C%20II%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩 |
1011
| [211. 添加与搜索单词 - 数据结构设计](https://leetcode-cn.com/problems/design-add-and-search-words-data-structure/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/design-add-and-search-words-data-structure/solution/gong-shui-san-xie-yi-ti-shuang-jie-er-we-un94/) | 中等 | 🤩🤩🤩🤩🤩 |
1112
| [241. 为运算表达式设计优先级](https://leetcode.cn/problems/different-ways-to-add-parentheses/) | [LeetCode 题解链接](https://leetcode.cn/problems/different-ways-to-add-parentheses/solution/by-ac_oier-z07i/) | 中等 | 🤩🤩🤩🤩🤩 |
1213
| [282. 给表达式添加运算符](https://leetcode-cn.com/problems/expression-add-operators/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/expression-add-operators/solution/gong-shui-san-xie-hui-su-suan-fa-yun-yon-nl9z/) | 困难 | 🤩🤩🤩🤩 |

‎Index/二叉树.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
| 题目 | 题解 | 难度 | 推荐指数 |
22
| ------------------------------------------------------------ | ------------------------------------------------------------ | ---- | -------- |
33
| [95. 不同的二叉搜索树 II](https://leetcode.cn/problems/unique-binary-search-trees-ii/) | [LeetCode 题解链接](https://www.acoier.com/2022/12/09/95.%20%E4%B8%8D%E5%90%8C%E7%9A%84%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%20II%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩 |
4+
| [113. 路径总和 II](https://leetcode.cn/problems/path-sum-ii/) | [LeetCode 题解链接](https://acoier.com/2022/12/10/113.%20%E8%B7%AF%E5%BE%84%E6%80%BB%E5%92%8C%20II%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩 |
45
| [230. 二叉搜索树中第K小的元素](https://leetcode-cn.com/problems/kth-smallest-element-in-a-bst/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/kth-smallest-element-in-a-bst/solution/gong-shui-san-xie-yi-ti-san-jie-pai-xu-y-8uah/) | 中等 | 🤩🤩🤩🤩 |
56
| [240. 搜索二维矩阵 II](https://leetcode-cn.com/problems/search-a-2d-matrix-ii/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/search-a-2d-matrix-ii/solution/gong-shui-san-xie-yi-ti-shuang-jie-er-fe-y1ns/) | 中等 | 🤩🤩🤩🤩🤩 |
67
| [297. 二叉树的序列化与反序列化](https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/xu-lie-hua-er-cha-shu-lcof/solution/gong-shui-san-xie-er-cha-shu-de-xu-lie-h-n89a/) | 困难 | 🤩🤩🤩🤩🤩 |

‎Index/双指针.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
| [1592. 重新排列单词间的空格](https://leetcode.cn/problems/rearrange-spaces-between-words/) | [LeetCode 题解链接](https://leetcode.cn/problems/rearrange-spaces-between-words/solution/by-ac_oier-0f5h/) | 简单 | 🤩🤩🤩 |
6666
| [1610. 可见点的最大数目](https://leetcode-cn.com/problems/maximum-number-of-visible-points/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/maximum-number-of-visible-points/solution/gong-shui-san-xie-qiu-ji-jiao-ji-he-ti-b-0bid/) | 困难 | 🤩🤩🤩🤩 |
6767
| [1662. 检查两个字符串数组是否相等](https://leetcode.cn/problems/check-if-two-string-arrays-are-equivalent/) | [LeetCode 题解链接](https://leetcode.cn/problems/check-if-two-string-arrays-are-equivalent/solution/by-ac_oier-h0l6/) | 简单 | 🤩🤩🤩🤩 |
68+
| [1697. 检查边长度限制的路径是否存在](https://leetcode.cn/problems/checking-existence-of-edge-length-limited-paths/) | [LeetCode 题解链接](https://acoier.com/2022/12/14/1697.%20%E6%A3%80%E6%9F%A5%E8%BE%B9%E9%95%BF%E5%BA%A6%E9%99%90%E5%88%B6%E7%9A%84%E8%B7%AF%E5%BE%84%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8%EF%BC%88%E5%9B%B0%E9%9A%BE%EF%BC%89/) | 困难 | 🤩🤩🤩🤩 |
6869
| [1743. 从相邻元素对还原数组](https://leetcode-cn.com/problems/restore-the-array-from-adjacent-pairs/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/restore-the-array-from-adjacent-pairs/solution/gong-shui-san-xie-yi-ti-shuang-jie-dan-x-elpx/) | 中等 | 🤩🤩🤩🤩 |
6970
| [1748. 唯一元素的和](https://leetcode-cn.com/problems/sum-of-unique-elements/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/sum-of-unique-elements/solution/gong-shui-san-xie-yi-ti-shuang-jie-pai-x-atnd/) | 简单 | 🤩🤩🤩🤩 |
7071
| [1764. 通过连接另一个数组的子数组得到一个数组](https://leetcode-cn.com/problems/form-array-by-concatenating-subarrays-of-another-array/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/form-array-by-concatenating-subarrays-of-another-array/solution/clean-solutionni-jue-dui-neng-kan-dong-d-l4ts/) | 中等 | 🤩🤩🤩🤩 |

‎Index/并查集.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
| [952. 按公因数计算最大组件大小](https://leetcode.cn/problems/largest-component-size-by-common-factor/) | [LeetCode 题解链接](https://leetcode.cn/problems/largest-component-size-by-common-factor/solution/by-ac_oier-mw04/) | 困难 | 🤩🤩🤩🤩 |
1212
| [1020. 飞地的数量](https://leetcode-cn.com/problems/number-of-enclaves/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/number-of-enclaves/solution/gong-shui-san-xie-bing-cha-ji-dfs-yun-yo-oyh1/) | 中等 | 🤩🤩🤩 |
1313
| [1631. 最小体力消耗路径](https://leetcode-cn.com/problems/path-with-minimum-effort/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/path-with-minimum-effort/solution/fan-zheng-fa-zheng-ming-si-lu-de-he-fa-x-ohby/) | 中等 | 🤩🤩🤩 |
14+
| [1697. 检查边长度限制的路径是否存在](https://leetcode.cn/problems/checking-existence-of-edge-length-limited-paths/) | [LeetCode 题解链接](https://acoier.com/2022/12/14/1697.%20%E6%A3%80%E6%9F%A5%E8%BE%B9%E9%95%BF%E5%BA%A6%E9%99%90%E5%88%B6%E7%9A%84%E8%B7%AF%E5%BE%84%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8%EF%BC%88%E5%9B%B0%E9%9A%BE%EF%BC%89/) | 困难 | 🤩🤩🤩🤩🤩 |
1415

‎Index/序列 DP.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
| [1473. 粉刷房子 III](https://leetcode-cn.com/problems/paint-house-iii/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/paint-house-iii/solution/gong-shui-san-xie-san-wei-dong-tai-gui-h-ud7m/) | 困难 | 🤩🤩🤩🤩 |
2727
| [1537. 最大得分](https://leetcode.cn/problems/get-the-maximum-score/) | [LeetCode 题解链接](https://leetcode.cn/problems/get-the-maximum-score/solution/by-ac_oier-ht78/) | 困难 | 🤩🤩🤩🤩 |
2828
| [1668. 最大重复子字符串](https://leetcode.cn/problems/maximum-repeating-substring/) | [LeetCode 题解链接](https://leetcode.cn/problems/maximum-repeating-substring/solution/by-ac_oier-xjhn/) | 简单 | 🤩🤩🤩🤩🤩 |
29+
| [1691. 堆叠长方体的最大高度](https://leetcode.cn/problems/maximum-height-by-stacking-cuboids/) | [LeetCode 题解链接](https://acoier.com/2022/12/10/1691.%20%E5%A0%86%E5%8F%A0%E9%95%BF%E6%96%B9%E4%BD%93%E7%9A%84%E6%9C%80%E5%A4%A7%E9%AB%98%E5%BA%A6%EF%BC%88%E5%9B%B0%E9%9A%BE%EF%BC%89/) | 困难 | 🤩🤩🤩🤩 |
2930
| [1713. 得到子序列的最少操作次数](https://leetcode-cn.com/problems/minimum-operations-to-make-a-subsequence/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/minimum-operations-to-make-a-subsequence/solution/gong-shui-san-xie-noxiang-xin-ke-xue-xi-oj7yu/) | 困难 | 🤩🤩🤩🤩🤩 |
3031
| [1751. 最多可以参加的会议数目 II](https://leetcode-cn.com/problems/maximum-number-of-events-that-can-be-attended-ii/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/maximum-number-of-events-that-can-be-attended-ii/solution/po-su-dp-er-fen-dp-jie-fa-by-ac_oier-88du/) | 困难 | 🤩🤩🤩🤩 |
3132

‎Index/排序.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
| [1608. 特殊数组的特征值](https://leetcode.cn/problems/special-array-with-x-elements-greater-than-or-equal-x/) | [LeetCode 题解链接](https://leetcode.cn/problems/special-array-with-x-elements-greater-than-or-equal-x/solution/by-ac_oier-z525/) | 简单 | 🤩🤩🤩🤩🤩 |
3232
| [1640. 能否连接形成数组](https://leetcode.cn/problems/check-array-formation-through-concatenation/) | [LeetCode 题解链接](https://leetcode.cn/problems/check-array-formation-through-concatenation/solution/by-ac_oier-3jqf/) | 简单 | 🤩🤩🤩🤩 |
3333
| [1636. 按照频率将数组升序排序](https://leetcode.cn/problems/sort-array-by-increasing-frequency/) | [LeetCode 题解链接](https://leetcode.cn/problems/sort-array-by-increasing-frequency/solution/by-ac_oier-c3xc/) | 简单 | 🤩🤩🤩🤩 |
34+
| [1691. 堆叠长方体的最大高度](https://leetcode.cn/problems/maximum-height-by-stacking-cuboids/) | [LeetCode 题解链接](https://acoier.com/2022/12/10/1691.%20%E5%A0%86%E5%8F%A0%E9%95%BF%E6%96%B9%E4%BD%93%E7%9A%84%E6%9C%80%E5%A4%A7%E9%AB%98%E5%BA%A6%EF%BC%88%E5%9B%B0%E9%9A%BE%EF%BC%89/) | 困难 | 🤩🤩🤩🤩 |
35+
| [1697. 检查边长度限制的路径是否存在](https://leetcode.cn/problems/checking-existence-of-edge-length-limited-paths/) | [LeetCode 题解链接](https://acoier.com/2022/12/14/1697.%20%E6%A3%80%E6%9F%A5%E8%BE%B9%E9%95%BF%E5%BA%A6%E9%99%90%E5%88%B6%E7%9A%84%E8%B7%AF%E5%BE%84%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8%EF%BC%88%E5%9B%B0%E9%9A%BE%EF%BC%89/) | 困难 | 🤩🤩🤩 |
3436
| [1833. 雪糕的最大数量](https://leetcode-cn.com/problems/maximum-ice-cream-bars/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/maximum-ice-cream-bars/solution/gong-shui-san-xie-noxiang-xin-ke-xue-xi-yrhjx/) | 中等 | 🤩🤩🤩🤩🤩 |
3537
| [1834. 单线程 CPU](https://leetcode-cn.com/problems/single-threaded-cpu/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/single-threaded-cpu/solution/gong-shui-san-xie-shu-ju-jie-gou-yun-yon-1qk0/) | 中等 | 🤩🤩🤩🤩 |
3638
| [1838. 最高频元素的频数](https://leetcode-cn.com/problems/frequency-of-the-most-frequent-element/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/frequency-of-the-most-frequent-element/solution/gong-shui-san-xie-cong-mei-ju-dao-pai-xu-kxnk/) | 中等 | 🤩🤩🤩 |

‎Index/数学.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
| [1734. 解码异或后的排列](https://leetcode-cn.com/problems/decode-xored-permutation/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/decode-xored-permutation/solution/gong-shui-san-xie-note-bie-pian-li-yong-zeh6o/) | 中等 | 🤩🤩🤩🤩 |
8181
| [1738. 找出第 K 大的异或坐标值](https://leetcode-cn.com/problems/find-kth-largest-xor-coordinate-value/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/find-kth-largest-xor-coordinate-value/solution/gong-shui-san-xie-xiang-jie-li-yong-er-w-ai0d/) | 中等 | 🤩🤩🤩 |
8282
| [1775. 通过最少操作次数使数组的和相等](https://leetcode.cn/problems/equal-sum-arrays-with-minimum-number-of-operations/) | [LeetCode 题解链接](https://acoier.com/2022/12/09/1775.%20%E9%80%9A%E8%BF%87%E6%9C%80%E5%B0%91%E6%93%8D%E4%BD%9C%E6%AC%A1%E6%95%B0%E4%BD%BF%E6%95%B0%E7%BB%84%E7%9A%84%E5%92%8C%E7%9B%B8%E7%AD%89%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩 |
83+
| [1780. 判断一个数字是否可以表示成三的幂的和](https://leetcode.cn/problems/check-if-number-is-a-sum-of-powers-of-three/) | [LeetCode 题解链接](https://acoier.com/2022/12/12/1780.%20%E5%88%A4%E6%96%AD%E4%B8%80%E4%B8%AA%E6%95%B0%E5%AD%97%E6%98%AF%E5%90%A6%E5%8F%AF%E4%BB%A5%E8%A1%A8%E7%A4%BA%E6%88%90%E4%B8%89%E7%9A%84%E5%B9%82%E7%9A%84%E5%92%8C%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩🤩 |
8384
| [剑指 Offer 44. 数字序列中某一位的数字](https://leetcode.cn/problems/shu-zi-xu-lie-zhong-mou-yi-wei-de-shu-zi-lcof/) | [LeetCode 题解链接](https://leetcode.cn/problems/shu-zi-xu-lie-zhong-mou-yi-wei-de-shu-zi-lcof/solution/by-ac_oier-wgr8/) | 中等 | 🤩🤩🤩🤩 |
8485
| [面试题 10.02. 变位词组](https://leetcode-cn.com/problems/group-anagrams-lcci/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/group-anagrams-lcci/solution/gong-shui-san-xie-tong-ji-bian-wei-ci-de-0iqe/) | 中等 | 🤩🤩🤩🤩 |
8586
| [面试题 17.19. 消失的两个数字](https://leetcode.cn/problems/missing-two-lcci/) | [LeetCode 题解链接](https://leetcode.cn/problems/missing-two-lcci/solution/by-ac_oier-pgeh/) | 困难 | 🤩🤩🤩🤩 |
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
### 题目描述
2+
3+
这是 LeetCode 上的 **[113. 路径总和 II](https://acoier.com/2022/12/10/113.%20%E8%B7%AF%E5%BE%84%E6%80%BB%E5%92%8C%20II%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/)** ,难度为 **中等**
4+
5+
Tag : 「DFS」、「二叉树」
6+
7+
8+
9+
给你二叉树的根节点 `root` 和一个整数目标和 `targetSum`,找出所有 从根节点到叶子节点 路径总和等于给定目标和的路径。
10+
11+
叶子节点 是指没有子节点的节点。
12+
13+
示例 1:
14+
![](https://assets.leetcode.com/uploads/2021/01/18/pathsumii1.jpg)
15+
16+
```
17+
输入:root = [5,4,8,11,null,13,4,7,2,null,null,5,1], targetSum = 22
18+
19+
输出:[[5,4,11,2],[5,8,4,5]]
20+
```
21+
示例 2:
22+
![](https://assets.leetcode.com/uploads/2021/01/18/pathsum2.jpg)
23+
```
24+
输入:root = [1,2,3], targetSum = 5
25+
26+
输出:[]
27+
```
28+
示例 3:
29+
```
30+
输入:root = [1,2], targetSum = 0
31+
32+
输出:[]
33+
```
34+
35+
提示:
36+
* 树中节点总数在范围 $[0, 5000]$ 内
37+
* $-1000 <= Node.val <= 1000$
38+
* $-1000 <= targetSum <= 1000$
39+
40+
---
41+
42+
### 树的遍历 - DFS
43+
44+
定义 `DFS` 函数 `void dfs(TreeNode root, int cur, int t, List<Integer> path)`
45+
46+
其中 `root` 为当前遍历到的节点;`cur` 为当前路径总和;`t` 为目标总和;`path` 为当前路径方案。
47+
48+
剩下的为常规的树的遍历,当 `root` 为叶子节点(既没有左子树,也没有右子树)时,根据 `cur` 是否与 `t` 相等,决定是否要把 `path` 添加到答案中。
49+
50+
代码:
51+
```Java
52+
class Solution {
53+
List<List<Integer>> ans = new ArrayList<>();
54+
public List<List<Integer>> pathSum(TreeNode root, int t) {
55+
if (root != null) dfs(root, root.val, t, new ArrayList<>(){{add(root.val);}});
56+
return ans;
57+
}
58+
void dfs(TreeNode root, int cur, int t, List<Integer> path) {
59+
if (root.left == null && root.right == null) {
60+
if (cur == t) ans.add(new ArrayList<>(path));
61+
return ;
62+
}
63+
List<TreeNode> list = new ArrayList<>();
64+
if (root.left != null) list.add(root.left);
65+
if (root.right != null) list.add(root.right);
66+
for (TreeNode child : list) {
67+
path.add(child.val);
68+
dfs(child, cur + child.val, t, path);
69+
path.remove(path.size() - 1);
70+
}
71+
}
72+
}
73+
```
74+
* 时间复杂度:$O(n)$
75+
* 空间复杂度:$O(n)$
76+
77+
---
78+
79+
### 最后
80+
81+
这是我们「刷穿 LeetCode」系列文章的第 `No.113` 篇,系列开始于 2021年01月01日,截止于起始日 LeetCode 上共有 1916 道题目,部分是有锁题,我们将先把所有不带锁的题目刷完。
82+
83+
在这个系列文章里面,除了讲解解题思路以外,还会尽可能给出最为简洁的代码。如果涉及通解还会相应的代码模板。
84+
85+
为了方便各位同学能够电脑上进行调试和提交代码,我建立了相关的仓库:https://github.com/SharingSource/LogicStack-LeetCode
86+
87+
在仓库地址里,你可以看到系列文章的题解链接、系列文章的相应代码、LeetCode 原题链接和其他优选题解。
88+

‎LeetCode/111-120/115. 不同的子序列(困难).md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
### 题目描述
22

3-
这是 LeetCode 上的 **[115. 不同的子序列]()** ,难度为 **困难**
3+
这是 LeetCode 上的 **[115. 不同的子序列](https://leetcode.cn/problems/distinct-subsequences/solution/xiang-jie-zi-fu-chuan-pi-pei-wen-ti-de-t-wdtk/)** ,难度为 **困难**
44

55
Tag : 「线性 DP」
66

77

88

9-
给定一个字符串 s 和一个字符串 t ,计算在 s 的子序列中 t 出现的个数。
9+
给定一个字符串 `s` 和一个字符串 `t` ,计算在 `s` 的子序列中 `t` 出现的个数。
1010

11-
字符串的一个 子序列 是指,通过删除一些(也可以不删除)字符且不干扰剩余字符相对位置所组成的新字符串。(例如,"ACE" 是 "ABCDE" 的一个子序列,而 "AEC" 不是)
11+
字符串的一个 子序列 是指,通过删除一些(也可以不删除)字符且不干扰剩余字符相对位置所组成的新字符串。(例如,`"ACE"``"ABCDE"` 的一个子序列,而 `"AEC"` 不是)
1212

13-
题目数据保证答案符合 32 位带符号整数范围。
13+
题目数据保证答案符合 `32` 位带符号整数范围。
1414

1515

1616
示例 1:
1717
```
1818
输入:s = "rabbbit", t = "rabbit"
19+
1920
输出:3
21+
2022
解释:
2123
如下图所示, 有 3 种可以从 s 中得到 "rabbit" 的方案。
2224
(上箭头符号 ^ 表示选取的字母)
@@ -30,7 +32,9 @@ rabbbit
3032
示例 2:
3133
```
3234
输入:s = "babgbag", t = "bag"
35+
3336
输出:5
37+
3438
解释:
3539
如下图所示, 有 5 种可以从 s 中得到 "bag" 的方案。
3640
(上箭头符号 ^ 表示选取的字母)
@@ -47,8 +51,8 @@ babgbag
4751
```
4852

4953
提示:
50-
* 0 <= s.length, t.length <= 1000
51-
* st 由英文字母组成
54+
* $0 <= s.length, t.length <= 1000$
55+
* `s``t` 由英文字母组成
5256

5357
---
5458

@@ -108,10 +112,11 @@ class Solution {
108112
}
109113
}
110114
```
111-
* 时间复杂度:$O(n * m)$
112-
* 空间复杂度:$O(n * m)$
115+
* 时间复杂度:$O(n \times m)$
116+
* 空间复杂度:$O(n \times m)$
113117

114118
*PS. 需要说明的是,由于中间结果会溢出,CPP 中必须使用 long long,而 Java 不用。由于 Java 中 int 的存储机制,只要在运算过程中只要不涉及取 min、取 max 或者其他比较操作的话,中间结果溢出不会影响最终结果。*
119+
115120
***
116121

117122
### 总结

0 commit comments

Comments
(0)

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