mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
Merge branch 'youngyangyang04:master' into master
This commit is contained in:
@ -76,11 +76,9 @@ public:
|
||||
for (int i = 0; i < nums.size(); i++) {
|
||||
nextDistance = max(nums[i] + i, nextDistance); // 更新下一步覆盖最远距离下标
|
||||
if (i == curDistance) { // 遇到当前覆盖最远距离下标
|
||||
if (curDistance < nums.size() - 1) { // 如果当前覆盖最远距离下标不是终点
|
||||
ans++; // 需要走下一步
|
||||
curDistance = nextDistance; // 更新当前覆盖最远距离下标(相当于加油了)
|
||||
if (nextDistance >= nums.size() - 1) break; // 下一步的覆盖范围已经可以达到终点,结束循环
|
||||
} else break; // 当前覆盖最远距到达集合终点,不用做ans++操作了,直接结束
|
||||
ans++; // 需要走下一步
|
||||
curDistance = nextDistance; // 更新当前覆盖最远距离下标(相当于加油了)
|
||||
if (nextDistance >= nums.size() - 1) break; // 当前覆盖最远距到达集合终点,不用做ans++操作了,直接结束
|
||||
}
|
||||
}
|
||||
return ans;
|
||||
|
@ -312,24 +312,22 @@ object Solution {
|
||||
|
||||
```Rust
|
||||
impl Solution {
|
||||
fn max(a: i32, b: i32) -> i32 {
|
||||
if a > b { a } else { b }
|
||||
}
|
||||
|
||||
pub fn merge(intervals: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
|
||||
let mut intervals = intervals;
|
||||
let mut result = Vec::new();
|
||||
if intervals.len() == 0 { return result; }
|
||||
intervals.sort_by(|a, b| a[0].cmp(&b[0]));
|
||||
result.push(intervals[0].clone());
|
||||
for i in 1..intervals.len() {
|
||||
if result.last_mut().unwrap()[1] >= intervals[i][0] {
|
||||
result.last_mut().unwrap()[1] = Self::max(result.last_mut().unwrap()[1], intervals[i][1]);
|
||||
pub fn merge(mut intervals: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
|
||||
let mut res = vec![];
|
||||
if intervals.is_empty() {
|
||||
return res;
|
||||
}
|
||||
intervals.sort_by_key(|a| a[0]);
|
||||
res.push(intervals[0].clone());
|
||||
for interval in intervals.into_iter().skip(1) {
|
||||
let res_last_ele = res.last_mut().unwrap();
|
||||
if res_last_ele[1] >= interval[0] {
|
||||
res_last_ele[1] = interval[1].max(res_last_ele[1]);
|
||||
} else {
|
||||
result.push(intervals[i].clone());
|
||||
res.push(interval);
|
||||
}
|
||||
}
|
||||
result
|
||||
res
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -101,6 +101,11 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(nm)
|
||||
* 空间复杂度: O(n)
|
||||
|
||||
|
||||
|
||||
代码中m表示最多可以爬m个台阶,代码中把m改成2就是本题70.爬楼梯可以AC的代码了。
|
||||
|
||||
## 总结
|
||||
|
@ -218,6 +218,10 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 时间复杂度: O(n * m)
|
||||
* 空间复杂度: O(n * m)
|
||||
|
||||
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
代码如下:
|
||||
```CPP
|
||||
int getdepth(treenode* node)
|
||||
int getdepth(TreeNode* node)
|
||||
```
|
||||
|
||||
2. 确定终止条件:如果为空节点的话,就返回0,表示高度为0。
|
||||
@ -76,14 +76,14 @@ return depth;
|
||||
```CPP
|
||||
class solution {
|
||||
public:
|
||||
int getdepth(treenode* node) {
|
||||
int getdepth(TreeNode* node) {
|
||||
if (node == NULL) return 0;
|
||||
int leftdepth = getdepth(node->left); // 左
|
||||
int rightdepth = getdepth(node->right); // 右
|
||||
int depth = 1 + max(leftdepth, rightdepth); // 中
|
||||
return depth;
|
||||
}
|
||||
int maxdepth(treenode* root) {
|
||||
int maxDepth(TreeNode* root) {
|
||||
return getdepth(root);
|
||||
}
|
||||
};
|
||||
@ -93,9 +93,9 @@ public:
|
||||
```CPP
|
||||
class solution {
|
||||
public:
|
||||
int maxdepth(treenode* root) {
|
||||
int maxDepth(TreeNode* root) {
|
||||
if (root == null) return 0;
|
||||
return 1 + max(maxdepth(root->left), maxdepth(root->right));
|
||||
return 1 + max(maxDepth(root->left), maxDepth(root->right));
|
||||
}
|
||||
};
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
class solution {
|
||||
public:
|
||||
int result;
|
||||
void getdepth(treenode* node, int depth) {
|
||||
void getdepth(TreeNode* node, int depth) {
|
||||
result = depth > result ? depth : result; // 中
|
||||
|
||||
if (node->left == NULL && node->right == NULL) return ;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
}
|
||||
return ;
|
||||
}
|
||||
int maxdepth(treenode* root) {
|
||||
int maxDepth(TreeNode* root) {
|
||||
result = 0;
|
||||
if (root == NULL) return result;
|
||||
getdepth(root, 1);
|
||||
@ -144,7 +144,7 @@ public:
|
||||
class solution {
|
||||
public:
|
||||
int result;
|
||||
void getdepth(treenode* node, int depth) {
|
||||
void getdepth(TreeNode* node, int depth) {
|
||||
result = depth > result ? depth : result; // 中
|
||||
if (node->left == NULL && node->right == NULL) return ;
|
||||
if (node->left) { // 左
|
||||
@ -155,7 +155,7 @@ public:
|
||||
}
|
||||
return ;
|
||||
}
|
||||
int maxdepth(treenode* root) {
|
||||
int maxDepth(TreeNode* root) {
|
||||
result = 0;
|
||||
if (root == 0) return result;
|
||||
getdepth(root, 1);
|
||||
@ -182,16 +182,16 @@ c++代码如下:
|
||||
```CPP
|
||||
class solution {
|
||||
public:
|
||||
int maxdepth(treenode* root) {
|
||||
int maxDepth(TreeNode* root) {
|
||||
if (root == NULL) return 0;
|
||||
int depth = 0;
|
||||
queue<treenode*> que;
|
||||
queue<TreeNode*> que;
|
||||
que.push(root);
|
||||
while(!que.empty()) {
|
||||
int size = que.size();
|
||||
depth++; // 记录深度
|
||||
for (int i = 0; i < size; i++) {
|
||||
treenode* node = que.front();
|
||||
TreeNode* node = que.front();
|
||||
que.pop();
|
||||
if (node->left) que.push(node->left);
|
||||
if (node->right) que.push(node->right);
|
||||
@ -230,11 +230,11 @@ c++代码:
|
||||
```CPP
|
||||
class solution {
|
||||
public:
|
||||
int maxdepth(node* root) {
|
||||
int maxDepth(Node* root) {
|
||||
if (root == 0) return 0;
|
||||
int depth = 0;
|
||||
for (int i = 0; i < root->children.size(); i++) {
|
||||
depth = max (depth, maxdepth(root->children[i]));
|
||||
depth = max (depth, maxDepth(root->children[i]));
|
||||
}
|
||||
return depth + 1;
|
||||
}
|
||||
@ -247,15 +247,15 @@ public:
|
||||
```CPP
|
||||
class solution {
|
||||
public:
|
||||
int maxdepth(node* root) {
|
||||
queue<node*> que;
|
||||
int maxDepth(Node* root) {
|
||||
queue<Node*> que;
|
||||
if (root != NULL) que.push(root);
|
||||
int depth = 0;
|
||||
while (!que.empty()) {
|
||||
int size = que.size();
|
||||
depth++; // 记录深度
|
||||
for (int i = 0; i < size; i++) {
|
||||
node* node = que.front();
|
||||
Node* node = que.front();
|
||||
que.pop();
|
||||
for (int j = 0; j < node->children.size(); j++) {
|
||||
if (node->children[j]) que.push(node->children[j]);
|
||||
|
@ -250,7 +250,7 @@ private:
|
||||
vector<vector<int>> result;
|
||||
vector<int> path;
|
||||
// 递归函数不需要返回值,因为我们要遍历整个树
|
||||
void traversal(treenode* cur, int count) {
|
||||
void traversal(TreeNode* cur, int count) {
|
||||
if (!cur->left && !cur->right && count == 0) { // 遇到了叶子节点且找到了和为sum的路径
|
||||
result.push_back(path);
|
||||
return;
|
||||
@ -276,10 +276,10 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
vector<vector<int>> pathsum(treenode* root, int sum) {
|
||||
vector<vector<int>> pathSum(TreeNode* root, int sum) {
|
||||
result.clear();
|
||||
path.clear();
|
||||
if (root == null) return result;
|
||||
if (root == NULL) return result;
|
||||
path.push_back(root->val); // 把根节点放进路径
|
||||
traversal(root, sum - root->val);
|
||||
return result;
|
||||
|
@ -149,6 +149,11 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n * m)
|
||||
* 空间复杂度: O(n * m)
|
||||
|
||||
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
|
||||
|
@ -970,6 +970,49 @@ pub fn remove_extra_spaces(s: &mut Vec<char>) {
|
||||
}
|
||||
}
|
||||
```
|
||||
C:
|
||||
|
||||
```C
|
||||
// 翻转字符串中指定范围的字符
|
||||
void reverse(char* s, int start, int end) {
|
||||
for (int i = start, j = end; i < j; i++, j--) {
|
||||
int tmp = s[i];
|
||||
s[i] = s[j];
|
||||
s[j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// 删除字符串两端和中间多余的空格
|
||||
void removeExtraSpace(char* s) {
|
||||
int start = 0; // 指向字符串开头的指针
|
||||
int end = strlen(s) - 1; // 指向字符串结尾的指针
|
||||
while (s[start] == ' ') start++; // 移动指针 start,直到找到第一个非空格字符
|
||||
while (s[end] == ' ') end--; // 移动指针 end,直到找到第一个非空格字符
|
||||
int slow = 0; // 指向新字符串的下一个写入位置的指针
|
||||
for (int i = start; i <= end; i++) { // 遍历整个字符串
|
||||
if (s[i] == ' ' && s[i+1] == ' ') { // 如果当前字符是空格,并且下一个字符也是空格,则跳过
|
||||
continue;
|
||||
}
|
||||
s[slow] = s[i]; // 否则,将当前字符复制到新字符串的 slow 位置
|
||||
slow++; // 将 slow 指针向后移动
|
||||
}
|
||||
s[slow] = '\0'; // 在新字符串的末尾添加一个空字符
|
||||
}
|
||||
|
||||
// 翻转字符串中的单词
|
||||
char * reverseWords(char * s){
|
||||
removeExtraSpace(s); // 先删除字符串两端和中间的多余空格
|
||||
reverse(s, 0, strlen(s) - 1); // 翻转整个字符串
|
||||
int slow = 0; // 指向每个单词的开头位置的指针
|
||||
for (int i = 0; i <= strlen(s); i++) { // 遍历整个字符串
|
||||
if (s[i] ==' ' || s[i] == '\0') { // 如果当前字符是空格或空字符,说明一个单词结束了
|
||||
reverse(s, slow, i-1); // 翻转单词
|
||||
slow = i + 1; // 将 slow 指针指向下一个单词的开头位置
|
||||
}
|
||||
}
|
||||
return s; // 返回处理后的字符串
|
||||
}
|
||||
```
|
||||
|
||||
<p align="center">
|
||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||
|
@ -156,6 +156,11 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n * k),其中 n 为 prices 的长度
|
||||
* 空间复杂度: O(n * k)
|
||||
|
||||
|
||||
|
||||
当然有的解法是定义一个三维数组dp[i][j][k],第i天,第j次买卖,k表示买还是卖的状态,从定义上来讲是比较直观。
|
||||
|
||||
但感觉三维数组操作起来有些麻烦,我是直接用二维数组来模拟三维数组的情况,代码看起来也清爽一些。
|
||||
|
@ -108,6 +108,9 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n)
|
||||
* 空间复杂度: O(n)
|
||||
|
||||
## 总结
|
||||
|
||||
打家劫舍是DP解决的经典题目,这道题也是打家劫舍入门级题目,后面我们还会变种方式来打劫的。
|
||||
|
@ -316,8 +316,8 @@ class Solution:
|
||||
def removeElements(self, head: ListNode, val: int) -> ListNode:
|
||||
dummy_head = ListNode(next=head) #添加一个虚拟节点
|
||||
cur = dummy_head
|
||||
while(cur.next!=None):
|
||||
if(cur.next.val == val):
|
||||
while cur.next:
|
||||
if cur.next.val == val:
|
||||
cur.next = cur.next.next #删除cur.next节点
|
||||
else:
|
||||
cur = cur.next
|
||||
|
@ -82,6 +82,11 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n)
|
||||
* 空间复杂度: O(n)
|
||||
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
成环之后还是难了一些的, 不少题解没有把“考虑房间”和“偷房间”说清楚。
|
||||
|
@ -127,6 +127,10 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n * √n)
|
||||
* 空间复杂度: O(n)
|
||||
|
||||
|
||||
同样我在给出先遍历物品,在遍历背包的代码,一样的可以AC的。
|
||||
|
||||
```CPP
|
||||
@ -145,6 +149,8 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 同上
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
|
@ -106,6 +106,10 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 时间复杂度: O(n^2)
|
||||
* 空间复杂度: O(n)
|
||||
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
|
@ -133,6 +133,11 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n * amount),其中 n 为 coins 的长度
|
||||
* 空间复杂度: O(amount)
|
||||
|
||||
|
||||
|
||||
对于遍历方式遍历背包放在外循环,遍历物品放在内循环也是可以的,我就直接给出代码了
|
||||
|
||||
```CPP
|
||||
@ -154,6 +159,8 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 同上
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
|
@ -380,7 +380,33 @@ class Solution:
|
||||
backtracking("JFK")
|
||||
return path
|
||||
```
|
||||
|
||||
python - 使用used数组 - 神似之前几题写法
|
||||
|
||||
```python
|
||||
class Solution:
|
||||
def findItinerary(self, tickets: List[List[str]]) -> List[str]:
|
||||
global used,path,results
|
||||
used = [0]*len(tickets)
|
||||
path = ['JFK']
|
||||
results = []
|
||||
tickets.sort() # 先排序,这样一旦找到第一个可行路径,一定是字母排序最小的
|
||||
self.backtracking(tickets,'JFK')
|
||||
return results[0]
|
||||
def backtracking(self,tickets,cur):
|
||||
if sum(used) == len(tickets):
|
||||
results.append(path[:])
|
||||
return True # 只要找到就返回
|
||||
for i in range(len(tickets)):
|
||||
if tickets[i][0]==cur and used[i]==0:
|
||||
used[i]=1
|
||||
path.append(tickets[i][1])
|
||||
state = self.backtracking(tickets,tickets[i][1])
|
||||
path.pop()
|
||||
used[i]=0
|
||||
if state: return True # 只要找到就返回,不继续搜索了
|
||||
```
|
||||
|
||||
### GO
|
||||
```go
|
||||
type pair struct {
|
||||
|
@ -130,6 +130,11 @@ public:
|
||||
|
||||
```
|
||||
|
||||
* 时间复杂度: O(target * n),其中 n 为 nums 的长度
|
||||
* 空间复杂度: O(target)
|
||||
|
||||
|
||||
|
||||
C++测试用例有两个数相加超过int的数据,所以需要在if里加上dp[i] < INT_MAX - dp[i - num]。
|
||||
|
||||
但java就不用考虑这个限制,java里的int也是四个字节吧,也有可能leetcode后台对不同语言的测试数据不一样。
|
||||
|
@ -156,6 +156,11 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(kmn),k 为strs的长度
|
||||
* 空间复杂度: O(mn)
|
||||
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
不少同学刷过这道题,可能没有总结这究竟是什么背包。
|
||||
|
@ -144,6 +144,11 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 时间复杂度: O(n^2)
|
||||
* 空间复杂度: O(n^2)
|
||||
|
||||
|
||||
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
|
@ -179,6 +179,11 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(mn),其中 m 是amount,n 是 coins 的长度
|
||||
* 空间复杂度: O(m)
|
||||
|
||||
|
||||
是不是发现代码如此精简,哈哈
|
||||
|
||||
## 总结
|
||||
|
@ -234,6 +234,26 @@ class Solution:
|
||||
return root
|
||||
|
||||
```
|
||||
**迭代**
|
||||
```python
|
||||
class Solution:
|
||||
def convertBST(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
|
||||
if not root: return root
|
||||
stack = []
|
||||
result = []
|
||||
cur = root
|
||||
pre = 0
|
||||
while cur or stack:
|
||||
if cur:
|
||||
stack.append(cur)
|
||||
cur = cur.right
|
||||
else:
|
||||
cur = stack.pop()
|
||||
cur.val+= pre
|
||||
pre = cur.val
|
||||
cur =cur.left
|
||||
return root
|
||||
```
|
||||
|
||||
## Go
|
||||
|
||||
|
@ -104,6 +104,10 @@ public:
|
||||
};
|
||||
|
||||
```
|
||||
* 时间复杂度: O(n * m)
|
||||
* 空间复杂度: O(n * m)
|
||||
|
||||
|
||||
|
||||
### 动态规划二
|
||||
|
||||
@ -127,6 +131,10 @@ public:
|
||||
};
|
||||
|
||||
```
|
||||
* 时间复杂度: O(n * m)
|
||||
* 空间复杂度: O(n * m)
|
||||
|
||||
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
|
@ -280,18 +280,20 @@ object Solution {
|
||||
```Rust
|
||||
impl Solution {
|
||||
pub fn monotone_increasing_digits(n: i32) -> i32 {
|
||||
let mut str_num = n.to_string().chars().map(|x| x.to_digit(10).unwrap() as i32).collect::<Vec<i32>>();
|
||||
let mut flag = str_num.len();
|
||||
for i in (1..str_num.len()).rev() {
|
||||
if str_num[i - 1] > str_num[i] {
|
||||
let mut n_bytes = n.to_string().into_bytes();
|
||||
let mut flag = n_bytes.len();
|
||||
for i in (1..n_bytes.len()).rev() {
|
||||
if n_bytes[i - 1] > n_bytes[i] {
|
||||
flag = i;
|
||||
str_num[i - 1] -= 1;
|
||||
n_bytes[i - 1] -= 1;
|
||||
}
|
||||
}
|
||||
for i in flag..str_num.len() {
|
||||
str_num[i] = 9;
|
||||
for v in n_bytes.iter_mut().skip(flag) {
|
||||
*v = 57;
|
||||
}
|
||||
str_num.iter().fold(0, |acc, x| acc * 10 + x)
|
||||
n_bytes
|
||||
.into_iter()
|
||||
.fold(0, |acc, x| acc * 10 + x as i32 - 48)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -271,6 +271,7 @@ class Solution {
|
||||
```
|
||||
|
||||
Python:
|
||||
> 未精简版本
|
||||
|
||||
```python
|
||||
class Solution:
|
||||
@ -291,6 +292,21 @@ class Solution:
|
||||
return answer
|
||||
```
|
||||
|
||||
> 精简版本
|
||||
|
||||
```python
|
||||
class Solution:
|
||||
def dailyTemperatures(self, temperatures: List[int]) -> List[int]:
|
||||
answer = [0]*len(temperatures)
|
||||
stack = []
|
||||
for i in range(len(temperatures)):
|
||||
while len(stack)>0 and temperatures[i] > temperatures[stack[-1]]:
|
||||
answer[stack[-1]] = i - stack[-1]
|
||||
stack.pop()
|
||||
stack.append(i)
|
||||
return answer
|
||||
```
|
||||
|
||||
Go:
|
||||
|
||||
> 暴力法
|
||||
|
@ -535,8 +535,57 @@ function getIndexAfterDel(s: string, startIndex: number): number {
|
||||
}
|
||||
```
|
||||
|
||||
### Rust
|
||||
|
||||
> 双指针
|
||||
|
||||
```rust
|
||||
impl Solution {
|
||||
pub fn backspace_compare(s: String, t: String) -> bool {
|
||||
let (s, t) = (
|
||||
s.chars().collect::<Vec<char>>(),
|
||||
t.chars().collect::<Vec<char>>(),
|
||||
);
|
||||
Self::get_string(s) == Self::get_string(t)
|
||||
}
|
||||
|
||||
pub fn get_string(mut chars: Vec<char>) -> Vec<char> {
|
||||
let mut slow = 0;
|
||||
for i in 0..chars.len() {
|
||||
if chars[i] == '#' {
|
||||
slow = (slow as u32).saturating_sub(1) as usize;
|
||||
} else {
|
||||
chars[slow] = chars[i];
|
||||
slow += 1;
|
||||
}
|
||||
}
|
||||
chars.truncate(slow);
|
||||
chars
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> 双栈法
|
||||
|
||||
```rust
|
||||
impl Solution {
|
||||
pub fn backspace_compare(s: String, t: String) -> bool {
|
||||
Self::get_string(s) == Self::get_string(t)
|
||||
}
|
||||
|
||||
pub fn get_string(string: String) -> String {
|
||||
let mut s = String::new();
|
||||
for c in string.chars() {
|
||||
if c != '#' {
|
||||
s.push(c);
|
||||
} else if !s.is_empty() {
|
||||
s.pop();
|
||||
}
|
||||
}
|
||||
s
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<p align="center">
|
||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||
|
@ -62,6 +62,10 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 时间复杂度: O(n * m)
|
||||
* 空间复杂度: O(n * m)
|
||||
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
|
@ -124,6 +124,10 @@ public:
|
||||
}
|
||||
};
|
||||
```
|
||||
* 时间复杂度: O(n * m),其中 n 和 m 分别为 text1 和 text2 的长度
|
||||
* 空间复杂度: O(n * m)
|
||||
|
||||
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
|
Reference in New Issue
Block a user