Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/9935
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
문자열에서 패턴을 찾아서 삭제하고 남은 문자열을 반환하는 문제. 패턴이 사라지면 남은 문자열들은 그대로 합침. 이때 없던 패턴이 다시 생길 수 있음.
🔍 풀이 방법
KMP + 문자열 덮어쓰기?
KMP는 그대로 사용하되 문자열이 삭제되었을 때 새로운 문자열이 생기는 경우를 고려하여 모든 인덱스마다 비교를 시작할 패턴의 위치를 저장함. 만약 문자열이 abcabcdde 이고 패턴이 abcd라면 중간에 끼어있는 abcd가 사라지고 abcde가 되고 또 abcd를 빼면 e만 남음.
⏳ 회고
kmp는 그냥 기본적으로 바로 구현할 수 있을 정도로 연습해야겠음.