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.
😀 PR을 올리기 전 준비
🤩 이번주 문제
이상한 곱셈 Bronze2
서로 다른 부분 문자열의 개수 Silver3
문자열 압축 lv.1
🧑💻 어떻게 푸셨나요?
이상한 곱셈
처음에 그냥 단순하게 이중 반복문으로 푸니 시간초과가 나서
각 자리의 수를 list에 넣은 다음
1×3 + 1×4 + 2×3 + 2×4 + 1×3 + 1×4를 인수분해하면(1+2+1)x(3+4)임을 이용해서sum(A)xsum(B)로 구하였습니다.서로 다른 부분 문자열의 개수
반복문으로 모든 문자열을 구해서 list에 넣고 list를 set로 바꾸어 중복을 제거한 후 개수를 구하였습니다.
문자열 압축
s(입력받은 문자열)을 최소 1글자에서 최대 len(s)//2 글자 단위로 자르는 경우가 있겠고,각각의 경우에 대해서
ss(압축된 문자열)을 구해서 문자열 길이를 저장할 list에 집어넣었습니다.temp(비교할 가장 앞 문자열 한 단위)를 뒤에 있는 문자열 한 단위씩 순서대로 비교해가면서 개수를 증가시키고 달라지는 순간에ss에 붙이는데,마지막에 새롭게 시작하는 문자는
temp와cnt변수에 저장만 되고 끝나기 때문에 따로ss에 붙였습니다.✍️ 질문을 적어주세요.
.
📖 참고 사항
.