-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I'd propose to include DSU-based solution to this problem as it more efficient. If I'm not mistaken O(ElogV) would be time complexity and the approach saves some space as we don't recreate graph\tree into adjacency list prior dfs and loop over the edge list directly
- Loading branch information
1 parent
8a5aeb2
commit 3e265db
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters