[20251004] PRO / LV2 / 도넛과 막대 그래프 / 이종환 #1040
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.
🧷 문제 링크
https://school.programmers.co.kr/learn/courses/30/lessons/258711
🧭 풀이 시간
42분
👀 체감 난이도
✏️ 문제 설명
문제가 많이 길어서, 링크 참고 바람
🔍 풀이 방법
우선 잘 생각해보면, 새롭게 추가하는 노드는 자신으로 향하는 노드가 없다. 물론 이건 막대그래프의 시작점도 동일하지만, 막대그래프의 시작점은 항상 향하는 노드가 한개라는 차이가 있다.
이를 통해, 새롭게 추가된 노드를 알아내면된다.
이후 향하는 노드, 오는 노드의 개수에 따라 각각의 그래프가 셋 중 무엇인지 판단하면 된다.
⏳ 회고
스트릭 깨진김에 프로그래머스도 좀 풀어봐야겠다.