Skip to content

Commit ef7433b

Browse files
committed
684-redundant-connection.md Reworded.
1 parent 9eec7dd commit ef7433b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

solutions/1-1000/684-redundant-connection.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Output: [1,4]
4141
![](../../images/684.png)
4242

4343
- We are given `edges` data and need to divide them into multiple groups, each group can be abstracted into a **tree**.
44-
- Finally, those trees will be merged into one tree.
44+
- Finally, those trees can be merged into one tree if the redundant edge is removed.
4545
- `UnionFind` algorithm is designed for grouping and searching data.
4646

4747
### 'UnionFind' algorithm

solutions/1-1000/685-redundant-connection-ii.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Return _an edge that can be removed so that the resulting graph is a rooted tree
1212

1313
### Example 1
1414
![](../../images/examples/685_1.jpg)
15-
```
15+
```java
1616
Input: edges = [[1,2],[1,3],[2,3]]
1717
Output: [2,3]
1818
```
1919

2020
### Example 2
2121
![](../../images/examples/685_2.jpg)
22-
```
22+
```java
2323
Input: edges = [[1,2],[2,3],[3,4],[4,1],[1,5]]
2424
Output: [4,1]
2525
```
@@ -37,7 +37,7 @@ Output: [4,1]
3737
2. If there is no vertex with in-degree 2, once a cycle is formed, return the edge that causes the cycle.
3838

3939
- We are given `edges` data and need to divide them into multiple groups, each group can be abstracted into a **tree**.
40-
- Finally, those trees will be merged into one tree.
40+
- Finally, those trees can be merged into one tree if the redundant edge is removed.
4141
- `UnionFind` algorithm is designed for grouping and searching data.
4242

4343
### 'UnionFind' algorithm
@@ -47,7 +47,7 @@ Output: [4,1]
4747
- The `same_root(node1, node2)` method is used to determine whether two nodes are in the same tree.
4848

4949
## Approach
50-
1. Iterate `edges` data to look for the `two_conflict_edges` (two edges caused a vertex with in-degree 2).
50+
1. Iterate `edges` data to look for the `two_conflict_edges` (the two edges caused a vertex with in-degree 2).
5151
1. Initially, each node is in its own group.
5252
1. Iterate `edges` data and `unite(node1, node2)`.
5353
1. If there is no vertex with in-degree 2, as soon as `same_root(node1, node2) == true` (a cycle will be formed), return `[node1, node2]`.

solutions/dynamic_programming/unorganized.md

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ The principle of traversal (DFS or BFS) between `undirected graph` or `directed
1919
* First rule: don't visited nodes again. This rule make starting from a node to traverse the `undirected graph` have a direction.
2020
* The adjacent nodes of `undirected graph` are its non-visited neighbors.
2121
* The adjacent nodes of `directed graph` are its targeted nodes.
22+
23+
# Features
24+
* Add Google translate as a link. Link example: https://github-com.translate.goog/gazeldx/leetcode-solutions/blob/main/solutions/1-1000/122-best-time-to-buy-and-sell-stock-ii.md?_x_tr_sl=auto&_x_tr_tl=zh-CN&_x_tr_hl=en&_x_tr_pto=wapp

0 commit comments

Comments
 (0)