-
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
[kayden] Week 01 Solutions #327
Conversation
kjb512
commented
Aug 16, 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
고생하셨습니다. 이번주 모임에서 의논할 사안인것 같지만 현재 파일내용을 보시면 각 파일 맨 아래 라인브레이크가 설정되지 않아 빨간색 마크가 표시되어 있을거예요. 해당내용 수정해주시면 감사하겠습니다! |
number-of-1-bits/kayden.py
Outdated
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.
쉽고 간결한 풀이네요 👍 다만 해당 문제의 목적 자체는 이진연산을 활용하는 것이기에, 시간이 나신다면 다른 방법으로도 풀어서 시간복잡도를 줄여보는것도 좋을것같습니다!
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.
리뷰 해주셔서 감사합니다! 이진연산으로 풀어볼 생각은 못해봤네요! 내일 모임 전에 한번 시도해보겠습니다!
contains-duplicate/kayden.py
Outdated
class Solution: | ||
def containsDuplicate(self, nums: List[int]) -> bool: | ||
unique_nums = set(nums) | ||
return len(unique_nums) != len(nums) |
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.
간결함을 원하신다면 unique_nums를 그냥 return 다음으로 옮겨버리는거도 나쁘지 않아보이네요 :)
return len(set(nums)) != len(nums)
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.
한줄로 작성한게 훨씬 깔끔하네요!
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.
수고하셨습니다. 모임 전 전까지 병합 부탁드립니다.