Skip to content

Commit

Permalink
Merge pull request neetcode-gh#921 from vishaldesai516/patch-1
Browse files Browse the repository at this point in the history
Update 261-Graph-Valid-Tree.java
  • Loading branch information
Ahmad-A0 authored Aug 24, 2022
2 parents 4d3f3f7 + 8b9f4da commit 7ae3d84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion java/261-Graph-Valid-Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public boolean validTree(int n, int[][] edges) {

Set<Integer> visited = new HashSet<>();

return depthFirstSearch(0, -1, visited) && visited.size() == n;
return depthFirstSearch(edges[0][0], -1, visited) && visited.size() == n;
}

private boolean depthFirstSearch(
Expand Down

0 comments on commit 7ae3d84

Please sign in to comment.