[20251026] BOJ / G4 / Tree / 김민진 #1231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
Tree
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
주어진 그래프가 트리인지 그래프인지 판단하시오
하나의 트리만 트리로 인정함
🔍 풀이 방법
분리집합인데 union할 때 이미 union 진행했었다면 간선이 중복이기 때문에 이 경우를 거르기 위해
boolean을 반환하도록 함간선의 수가
N - 1이 아니면 트리가 아니므로 이것도 걸러줌⏳ 회고
기본적인 분리집합