You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/0100-0199/0133.Clone Graph/README_EN.md
+136-20
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,10 @@
6
6
7
7
<p>Given a reference of a node in a <strong><ahref="https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph"target="_blank">connected</a></strong> undirected graph.</p>
8
8
9
-
10
-
11
9
<p>Return a <ahref="https://en.wikipedia.org/wiki/Object_copying#Deep_copy"target="_blank"><strong>deep copy</strong></a> (clone) of the graph.</p>
12
10
13
-
14
-
15
11
<p>Each node in the graph contains a val (<code>int</code>) and a list (<code>List[Node]</code>) of its neighbors.</p>
16
12
17
-
18
-
19
13
<pre>
20
14
21
15
class Node {
@@ -28,27 +22,16 @@ class Node {
28
22
29
23
</pre>
30
24
31
-
32
-
33
25
<p> </p>
34
26
35
-
36
-
37
27
<p><strong>Test case format:</strong></p>
38
28
39
-
40
-
41
29
<p>For simplicity sake, each node's value is the same as the node's index (1-indexed). For example, the first node with <code>val = 1</code>, the second node with <code>val = 2</code>, and so on. The graph is represented in the test case using an adjacency list.</p>
42
30
43
-
44
-
45
31
<p><b>Adjacency list</b> is a collection of unordered <b>lists</b> used to represent a finite graph. Each list describes the set of neighbors of a node in the graph.</p>
46
32
47
-
48
-
49
33
<p>The given node will always be the first node with <code>val = 1</code>. You must return the <strong>copy of the given node</strong> as a reference to the cloned graph.</p>
0 commit comments