Skip to content

Commit e631d17

Browse files
refactor 261
1 parent 36f810c commit e631d17

File tree

1 file changed

+0
-23
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-23
lines changed

src/main/java/com/fishercoder/solutions/_261.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
*261. Graph Valid Tree
5-
*
6-
* Given n nodes labeled from 0 to n - 1 and a list of undirected edges
7-
* (each edge is a pair of nodes),
8-
* write a function to check whether these edges make up a valid tree.
9-
10-
For example:
11-
12-
Given n = 5 and edges = [[0, 1], [0, 2], [0, 3], [1, 4]], return true.
13-
14-
Given n = 5 and edges = [[0, 1], [1, 2], [2, 3], [1, 3], [1, 4]], return false.
15-
16-
Hint:
17-
18-
Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], what should your return? Is this case a valid tree?
19-
According to the definition of tree on Wikipedia:
20-
“a tree is an undirected graph in which any two vertices are connected by exactly one path.
21-
In other words, any connected graph without simple cycles is a tree.”
22-
23-
Note: you can assume that no duplicate edges will appear in edges.
24-
Since all edges are undirected, [0, 1] is the same as [1, 0] and thus will not appear together in edges.
25-
*/
263
public class _261 {
274

285
public static class Solution1 {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy