-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Jay-Mo-99] Week 5 #861
base: main
Are you sure you want to change the base?
[Jay-Mo-99] Week 5 #861
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상세 설명들을 써두는 점이 좋은 것 같습니다. 시간복잡도와 다양한 테스트 케이스를 고민해보는게 라이브 코딩테스트에서 어렵더라구요,, 이 부분 같이 고민해나가면 좋을 것 같습니다!
|
||
|
||
def encode(self, strs: List[str]) -> str: | ||
answer = '!@#$%123456789'.join(strs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
만약 strs배열의 구성요소가 ['!@#$%123456789', '!@#$%', ''!@#$%123456789123123'] 이라면 encode가 조금은 꼬이지 않을까 합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네, 구분자(!@#$%123456789) 가 strs의 요소로 나온다면 해당 풀이법은 유효하지 않습니다. 가장 안전한 방법은 strs의 각 요소의 길이를 측정하여 decode때 해당 길이를 기반으로 나눠주는 방법이라고 들었습니다.
tempDict = defaultdict(list) | ||
|
||
for s in strs: | ||
key = tuple(sorted(s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정렬을 하지 않고 다르게 풀면 시간복잡도를 줄일 수 있을 것 같은데 어떤 방법이 있을까요?
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.