Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
[2023-10-04] sumin #299 - #329
Merged
Merged
Conversation
ksumini
requested review from
Woo-Yeol, limstonestone and zsmalla
as code ownersOctober 9, 2023 13:51
Closed
zsmalla
approved these changes
Oct 12, 2023
zsmalla
left a comment
Contributor
There was a problem hiding this comment.
수민님 덕에 좋은 인사이트 얻어가는 것 같습니다! head,number,tail 나누는 것도 깔끔하게 잘 하신 것 같아요. 고생하셨습니다!
Contributor
There was a problem hiding this comment.
오 이렇게 하면 따로 flag변수를 두지 않아도 되는 군요! 좋은 인사이트 얻어갑니다.
Contributor
There was a problem hiding this comment.
와 정규표현식을 활용할 수 있겠다는 생각은 했지만, sort함수의 key로 두는 방법은 진짜 생각도 못했네요... 세상 사람들 왜이렇게 똑똑한거여
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 freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 Summary
풀이시간: 20분
<input>
files: 파일명(100글자 이내, 영문 대소문자, 숫자, 공백, 마침표, 빼기 부호만으로 이루어져있음), 1000개 이하의 파일
<solution>
head, number, tail을 나눠주고 정렬
<시간복잡도>
O(1000 * 100): files의 크기 * file의 최대 길이<회고>
head, number, tail을 일일히 나눠서 구현했는데..
다른 사람들 풀이를 보니 정규표현식으로 아주 깔끔하게 구현한 걸 확인..
[정규표현식 풀이]
정규표현식으로 구현할 때, number를 먼저 정렬하고, head를 정렬한다. 순서가 바뀌는 점 주의!
또, 파이썬 정렬에서 ['123', '0123']의 각 원소를 int로 변환해 정렬한다 했을 때, 같은 값이라면 순서도 유지된다는 걸 처음 알았음..