-
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
[재호] WEEK 01 solutions #297
Conversation
wogha95
commented
Aug 11, 2024
•
edited
Loading
edited
- Contains Duplicate #217
- Number of 1 Bits #232
- Top K Frequent Elements #237
- Kth Smallest Element In a Bst #252
- Palindromic Substrings #267
- 시간 복잡도가 O(n^2) 인 로직 이해중입니다.!
별건 아닌데 목록에 Top K Frequent Elements 문제가 2번 적혀있네요 ; ) |
PR 만드시고 나면 project 와 iterator 설정까지 부탁드립니다 : ) |
* @return {number} | ||
*/ | ||
var hammingWeight = function (n) { | ||
return n |
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.
저는 hamming weight가 뭔지 몰랐는데, Brian Kernighan's Algorithm 라는 방법도 있더라고요 참고해보시면 도움되실 것 같습니다
if (current.val >= 0) { | ||
if (k === 1) { | ||
result = current.val; | ||
} | ||
k -= 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.
따로 리스트를 사용하지 않으신 부분이 인상 깊네요! 고생하셨습니다~ 👍