[20251111] PGM / LV4 / 도둑질 / 강신지 #1378
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/42897
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
원형으로 배치된 집들이 있음. 도둑질을 할 건데, 인접한 두 집을 털수는 없음.
각 집에 있는 돈의 배열이 주어질 때 최대로 도둑질할 수 있는 금액을 구하는 문제
🔍 풀이 방법
원형으로 배치되어 있으므로 첫번째 집을 턴다면 마지막 집은 못 턴다.
그 점을 고려하여 첫번째 집을 고르는 경우와 고르지 않는 경우로 나눠 선형 DP 돌림.
⏳ 회고
원형이라는 것을 간과해서 틀렸었음.
또 2차원 dp를 두 번 돌렸더니 시간초과.