-
-
Notifications
You must be signed in to change notification settings - Fork 195
[Wan] Week 1 #683
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
[Wan] Week 1 #683
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.
첫주차 문제 풀이 고생 많으셨습니다!
남은 14주도 파이팅입니다!
const set = new Set<number>(); | ||
|
||
for (let i = 0; i < nums.length; i++) { | ||
if (set.has(nums[i])) { | ||
return true; | ||
} | ||
set.add(nums[i]); | ||
} | ||
|
||
return false; |
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.
아래와 같이 한줄로 풀이하는 방법도 있을것 같습니다 :)
new Set(nums).size !== nums.length;
const chars = s.replace(/[^a-z0-9]/gi, "").toLowerCase(); | ||
|
||
return chars === [...chars].reverse().join(""); |
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.
정규식과 리스트 관련 함수를 잘 활용하신것 같아요 :)
@taewanseoul 님, 프로젝트의 주차 지정이 안 되어 있이서 제가 대신 해드렸습니다. 스터디 진행 현황 파악에 중요한 부분이오니 다음 PR부터는 누락되지 않도록 주의 부탁드립니다. 관련해서 답안 제출 가이드도 참고하세요. |
확인 감사합니다! 주의하겠습니다. |
*/ | ||
function longestConsecutive(nums: number[]): number { | ||
const set = new Set(nums); | ||
const sorted = [...set].sort((a, b) => a - b); |
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을 사용하신김에 has로 원하는 수가 set안에 있는지 확인하는 방법을 사용할 수도 있을것같습니다!
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.