[20251116] PGM / LV2 / 조이스틱 / 강신지 #1422
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/42860
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
A로만 이루어진 문자열에서 시작하여 타겟 문자열을 만들어야함.
조이스틱을 위아래로 움직이면 알파벳이 순서대로 바뀌고, 좌우로 움직이면 커서이동.
조이스틱 최소 조작 횟수를 구해야 함.
🔍 풀이 방법
상하이동 횟수는 각 문자별로 A와의 차이를 이용해 구하고
좌우이동은 A가 연속적으로 있을 경우를 고려해 되돌아가는 경우와 비교하여 작은 값 선택.
⏳ 회고
A가 연속적으로 있을 경우에 대한 생각을 하는 데에 오래 걸렸다.