[PGS] 둘만의 암호 - #80
Open
been12151 wants to merge 17 commits into
Open
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.
🍪 문제 이름
Resolve: 둘만의 암호
🍊 문제 정의
inputs: 암호화할 문자열 (1 ≤ 길이 ≤ 1,000, 알파벳 소문자로만 구성)skip: 건너뛸 문자들이 담긴 문자열index: 이동할 칸 수 (1 ≤ index ≤ 100)outputs의 각 문자를 알파벳 순서상skip에 없는 문자만 세어index칸 이동한 결과 문자열예시
🍑 알고리즘 설계
각 문자에 대해
value를 1씩 증가시키면서skip에 없는 문자만 이동 횟수(moved)로 카운트.moved가index에 도달하면 해당 문자를 결과에 추가.z를 넘어가면a로 순환하도록 처리.🥝 최악 수행 시간 복잡도
O(n × index × 26)(n = s의 길이)🍰 특이 사항 (Optional)
skip을set으로 변환해두면in체크가 O(1)로 줄어드는데 자꾸 까먹는거 같아요...