-
-
Notifications
You must be signed in to change notification settings - Fork 247
[jongwanra] WEEK 01 solutions #1678
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
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.
첫 주 수고하셨습니다. 4문제도 잘 끝내시고 남은 14주도 화이팅합시다 :)
@printjin-gmailcom 리뷰 감사합니다. 반영 해뒀습니다:) |
[문제 접근 방법] | ||
Set 자료구조를 활용하여 중복 여부를 개수로 확인한다. | ||
|
||
[Complexity] |
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.
주어진 입력이 set으로 전환되는 비용에 대해 조금 더 구체적인 설명이 있으면 좋을 것 같아요!
return answer | ||
|
||
""" | ||
다른 사람의 풀이 |
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.
정렬 시 보편적으로 시간 복잡도 O(NlogN), 기수 정렬은 작성하신 바와 같이 입력 범위에 민감하기 때문에, 정렬 없이 문제를 해결하는 것이 포인트였습니다. 다양하게 접근해보신 고민이 보입니다.
구간의 시작점을 찾아 끊어질 때까지 증가하면서 찾는 다른 사람의 풀이도 흥미롭네요. 고생하셨습니다.
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.
union-find를 사용하는 풀이도 확인해보시면 좋을 것 같습니다. 조건에 따라 그룹핑하는 문제에 유용합니다.
|
||
[Plan] | ||
1. nums를 순회하면서 Hash Table에 key:element value:count 저장한다. | ||
2. nums를 순회하면서 Heap에 (count, element)를 count를 기준으로 Max Heap 형태로 저장한다. |
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.
저는 1번 수행 후, count:value로 추가적인 정렬 hash table을 만들었는데요, 빈도의 종류 S <= N이므로 빌드 비용 O(SlogN) 발생 후 인덱스 K로 접근하는 방향을 생각했습니다. heapify 비용이 싸니까 이 방식도 유용하네요. 배워갑니다!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!