[20250827] PGM / LV2 / 연속된 부분 수열의 합 / 김수연 #755
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/178870
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
기존 수열에서 임의의 두 인덱스의 원소와 그 사이의 원소를 모두 포함하는 부분 수열이며 합이 k인 부분 수열 중,
길이가 가장 짧은 수열의 시작과 마지막 인덱스 구하
🔍 풀이 방법
이분 탐색 사용
k랑 같으면 list에 추가하고,
작거나 같으면 end 인덱스를 하나 높이고,
크면 start 인덱스를 하나 높임
이후, 길이가 짧은 순서로 정렬해서 답 구함
⏳ 회고
으릅다..