Skip to content

Commit 73aba40

Browse files
committed
fix: graph-valid-tree
1 parent a6d7581 commit 73aba40

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

graph-valid-tree/Chaedie.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class Solution:
99
def validTree(self, n: int, edges: List[List[int]]) -> bool:
1010
if not n:
1111
return True
12+
if len(edges) != n - 1:
13+
return False
1214

1315
# Make Graph
1416
graph = {i: [] for i in range(n)}

0 commit comments

Comments
 (0)