Skip to content

Conversation

Satorien
Copy link
Owner

@Satorien Satorien commented Jun 2, 2025

問題文:https://neetcode.io/problems/count-connected-components
(LeetCode Premiumにつき、NeetCodeで代用)


- いくつかデータ構造が思い浮かんだ
- HashMapでchild→parent
- UnionFindで解けそう
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnionFind か DFS かでしょうね。

せっかく UnionFind 作るなら class を作って再利用性を高くし、読みやすくするとかも挑戦するといいかと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants