[20250320] BOJ / G2 / 안티 팰린드롬 / 권혁준 #269
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://www.acmicpc.net/problem/1545
🧭 풀이 시간
25분

👀 체감 난이도
✏️ 문제 설명
문자열을 반으로 접었을 때 겹치는 두 문자가 같은 쌍이 하나도 없으면 안티 팰린드롬이다.
주어진 문자열을 재배치해서 사전 순으로 가장 빠른 안티 팰린드롬을 찾아보자.
🔍 풀이 방법
[사용한 알고리즘]
사전 순으로 제일 빠른 문자부터 넣어주다가, 길이가 절반을 넘어가는 시점에서는 그 다음으로 빠른 문자 순으로 넣어주었다.
⏳ 회고
문자열 길이가 홀수일 때를 제대로 고려하지 않아서 시간이 좀 걸렸다