-
-
Notifications
You must be signed in to change notification settings - Fork 195
[hi-rachel] WEEK 01 solutions #1181
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
top-k-frequent-elements/hi-rachel.py
Outdated
if num in numdict: | ||
numdict[num] += 1 | ||
else: | ||
numdict[num] = 1 |
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.
defaultdict를 사용하셨으니까 num의 존재여부는 분기처리하지 않아도 될 것 같아요.
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.
defaultdict 사용법이 헷갈려서 넘어갔는데 정확히 짚고 갑니다. 감사합니다 :)
""" | ||
개선 코드 | ||
O(N) time, O(N) space | ||
""" |
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.
👍
- 올바른 default 사용 - 사용하지 않는 배열 삭제
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!