Date: Thu, 12 Nov 2020 12:00:29 +0800
Subject: [PATCH 33/37] =?UTF-8?q?Update=20UnionFind=E7=AE=97=E6=B3=95?=
=?UTF-8?q?=E5=BA=94=E7=94=A8.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
算法思维系列/UnionFind算法应用.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/算法思维系列/UnionFind算法应用.md b/算法思维系列/UnionFind算法应用.md
index c1af151..c3ce82f 100644
--- a/算法思维系列/UnionFind算法应用.md
+++ b/算法思维系列/UnionFind算法应用.md
@@ -317,7 +317,7 @@ class Solution {
public boolean validTree(int n, int[][] edges) {
// 树的特性:节点数 = 边数 + 1
if (edges.length != n - 1) return false;
- graph_261.Solution.DisjointSet djs = new graph_261.Solution.DisjointSet(n);
+ DisjointSet djs = new DisjointSet(n);
for (int[] edg : edges) {
// 判断连通情况(如果合并的两个点在一个连通分量里,说明有环)
if (!djs.union(edg[0], edg[1])) return false;
From 3360ffda0fd458460a9c4908a0d7c0c58f539373 Mon Sep 17 00:00:00 2001
From: dragon_li <49151509+1097452462@users.noreply.github.com>
Date: Thu, 12 Nov 2020 20:13:10 +0800
Subject: [PATCH 34/37] =?UTF-8?q?Update=20=E7=BC=BA=E5=A4=B1=E5=92=8C?=
=?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E5=85=83=E7=B4=A0.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
高频面试系列/缺失和重复的元素.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/高频面试系列/缺失和重复的元素.md b/高频面试系列/缺失和重复的元素.md
index 52c8d78..9e0b550 100644
--- a/高频面试系列/缺失和重复的元素.md
+++ b/高频面试系列/缺失和重复的元素.md
@@ -1,4 +1,4 @@
-# 如何寻找缺失和重复的元素
+# 如何寻找缺失和重复的元素
@@ -165,4 +165,4 @@ class Solution {
return new int[]{dup, missing};
}
}
-```
\ No newline at end of file
+```
From 1b2ec335ea4b1ae65ba4cb1e92ff2b9e318b1084 Mon Sep 17 00:00:00 2001
From: dragon_li <49151509+1097452462@users.noreply.github.com>
Date: Thu, 12 Nov 2020 20:15:23 +0800
Subject: [PATCH 35/37] =?UTF-8?q?Update=20=E7=BC=BA=E5=A4=B1=E5=92=8C?=
=?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E5=85=83=E7=B4=A0.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
高频面试系列/缺失和重复的元素.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/高频面试系列/缺失和重复的元素.md b/高频面试系列/缺失和重复的元素.md
index 9e0b550..eb21f4c 100644
--- a/高频面试系列/缺失和重复的元素.md
+++ b/高频面试系列/缺失和重复的元素.md
@@ -148,7 +148,7 @@ class Solution {
int n = nums.length;
int dup = -1;
for (int i = 0; i < n; i++) {
- // 元素是从 1 开始的
+ // 元素是从 1 开始的
int index = Math.abs(nums[i]) - 1;
// nums[index] 小于 0 则说明重复访问
if (nums[index] < 0)
@@ -160,7 +160,7 @@ class Solution {
for (int i = 0; i < n; i++)
// nums[i] 大于 0 则说明没有访问
if (nums[i] > 0)
- // 将索引转换成元素
+ // 将索引转换成元素
missing = i + 1;
return new int[]{dup, missing};
}
From 6e2126a860659a7165b61135ae6c36b172774f87 Mon Sep 17 00:00:00 2001
From: BruceCat <41747005+brucecat@users.noreply.github.com>
Date: Sun, 7 Mar 2021 17:00:22 +0800
Subject: [PATCH 36/37] =?UTF-8?q?=E3=80=90739.=20Daily=20Temperatures?=
=?UTF-8?q?=E3=80=91=E3=80=90Java=E3=80=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
数据结构系列/单调栈.md | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/数据结构系列/单调栈.md b/数据结构系列/单调栈.md
index feedf44..28b4f91 100644
--- a/数据结构系列/单调栈.md
+++ b/数据结构系列/单调栈.md
@@ -8,9 +8,11 @@
-
+
+
相关推荐:
+
* [回溯算法解题套路框架](https://labuladong.gitbook.io/algo)
* [动态规划解题套路框架](https://labuladong.gitbook.io/algo)
@@ -50,7 +52,7 @@ vector nextGreaterElement(vector& nums);
这个问题可以这样抽象思考:把数组的元素想象成并列站立的人,元素大小想象成人的身高。这些人面对你站成一列,如何求元素「2」的 Next Greater Number 呢?很简单,如果能够看到元素「2」,那么他后面可见的第一个人就是「2」的 Next Greater Number,因为比「2」小的元素身高不够,都被「2」挡住了,第一个露出来的就是答案。
-
+
这个情景很好理解吧?带着这个抽象的情景,先来看下代码。
@@ -142,7 +144,7 @@ while (true) {
**对于这种需求,常用套路就是将数组长度翻倍**:
-
+
这样,元素 3 就可以找到元素 4 作为 Next Greater Number 了,而且其他的元素都可以被正确地计算。
@@ -182,6 +184,10 @@ vector nextGreaterElements(vector& nums) {
======其他语言代码======
+
+### java
+
+```java
// 739. Daily Temperatures
class Solution {
public int[] dailyTemperatures(int[] T) {
@@ -199,3 +205,5 @@ class Solution {
return ans;
}
}
+```
+
From 20ce356b32a443b0656346197cf6e6603696cf2e Mon Sep 17 00:00:00 2001
From: BruceCat <41747005+brucecat@users.noreply.github.com>
Date: Sun, 7 Mar 2021 17:04:58 +0800
Subject: [PATCH 37/37] =?UTF-8?q?=E3=80=90739.=20Daily=20Temperatures?=
=?UTF-8?q?=E3=80=91=E3=80=90Java=E3=80=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
【739. Daily Temperatures】【Java】
---
数据结构系列/单调栈.md | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/数据结构系列/单调栈.md b/数据结构系列/单调栈.md
index 28b4f91..d49168b 100644
--- a/数据结构系列/单调栈.md
+++ b/数据结构系列/单调栈.md
@@ -8,11 +8,9 @@
-
-
+
相关推荐:
-
* [回溯算法解题套路框架](https://labuladong.gitbook.io/algo)
* [动态规划解题套路框架](https://labuladong.gitbook.io/algo)
@@ -52,7 +50,7 @@ vector nextGreaterElement(vector& nums);
这个问题可以这样抽象思考:把数组的元素想象成并列站立的人,元素大小想象成人的身高。这些人面对你站成一列,如何求元素「2」的 Next Greater Number 呢?很简单,如果能够看到元素「2」,那么他后面可见的第一个人就是「2」的 Next Greater Number,因为比「2」小的元素身高不够,都被「2」挡住了,第一个露出来的就是答案。
-
+
这个情景很好理解吧?带着这个抽象的情景,先来看下代码。
@@ -144,7 +142,7 @@ while (true) {
**对于这种需求,常用套路就是将数组长度翻倍**:
-
+
这样,元素 3 就可以找到元素 4 作为 Next Greater Number 了,而且其他的元素都可以被正确地计算。
@@ -184,7 +182,6 @@ vector nextGreaterElements(vector& nums) {
======其他语言代码======
-
### java
```java