-
-
Notifications
You must be signed in to change notification settings - Fork 304
[casentino] WEEK 03 solutions #2089
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
seungriyou
left a comment
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.
이번 한 주도 고생 많으셨습니다~!
| output += 1; | ||
| num = (num - 1) / 2; | ||
| } else { | ||
| num = num / 2; |
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.
n & n-1로 오른쪽에서부터 1인 비트를 하나씩 지워가며 개수를 세는 방식인 Brian Kernighan's 알고리즘이라는 방법도 있어 공유드립니다~!
| if (lowerStart <= characterCode && lowerEnd >= characterCode) { | ||
| return true; | ||
| } | ||
| if (numericStart <= characterCode && numericEnd >= characterCode) { |
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.
직관적이고 가독성 좋은 two pointer 풀이인 것 같습니다!
추가로 return true 조건들을 한 번에 or 조건으로 비교한 값 자체를 반환한다면 더 간결하게 작성할 수 있을 것 같아요!
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로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!