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.
아직 3문제 밖에 풀지 못하였지만, 일단 올려두겠습니다! 늦게 올려서 죄송합니다😓
💭최소신장트리(MST) 아이디어
최소 신장 트리 문제를 접하면서 느낀 점은, 알고리즘 자체는 템플릿을 외우면 풀린다고 느껴서 어렵지는 않았습니다.
기본 템플릿은 다음과 같습니다.
그래서, 템플릿을 알면 문제푸는것은 방법이 정해져있으므로, ‘이 문제가 왜 MST 문제인가’를 먼저 판단하는 게 더 중요하다고 생각이 들었습니다.
🎯MST문제인지 판별하는 포인트?
개인적으로 다음과 같은 표현이 문제에 보인다면 MST임을 의심해봐도 좋을 것 같습니다!(다른 의견도 환영합니다)
🐛문제를 풀면서 반복되었던 실수
서브트리를 다른 서브트리로 합치는 과정에서 잦은 실수가 있었습니다..
이론상 서브트리의 루트노드를 가지고 union을 실행해야 두 개의 집합이 온전히 이어지는데,
자꾸 그냥 노드 x,y를 사용해서 풀어 예제는 맞지만 제출하면 틀리는 기묘한 상황이 몇 차례 반복되었습니다.
✅ 잊지 말자!