[20251107] PGM / LV2 / 무인도 여행 / 강신지 #1344
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/154540
🧭 풀이 시간
35분
👀 체감 난이도
✏️ 문제 설명
숫자가 적힌 땅과 'X'인 바다로 구성된 지도가 주어졌을 때, 상하좌우로 연결된 숫자 땅덩어리는 무인도임. 각 섬마다 숫자를 모두 더한 뒤 오름차순으로 반환하는 문제
🔍 풀이 방법
BFS 써서 지도에서 방문하지 않은 숫자 땅을 발견할 때마다 상하좌우로 탐색해 해당 섬의 숫자를 누적하고, 탐색이 끝나면 리스트에 저장해 오름차순 정렬 후 반환
⏳ 회고