Skip to content

[Union Find] Number of Connected Components in an Undirected Graph #127

@sudosf

Description

@sudosf

Problem

Given n nodes and a list of undirected edges, return the number of connected components in the graph.

References

Difficulty

🟡 Medium

Companies

Microsoft, Facebook, Morgan Stanley

Notes

Language: Java
Classic Union Find application. Also solvable with BFS/DFS counting components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    graphGraph problemsmediumMedium difficulty

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions