-
-
Notifications
You must be signed in to change notification settings - Fork 195
[clara-shin] WEEK 02 solutions #1259
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
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.
저희 제출 가이드에 PR 제목에 대한 부분이 있어서 확인하고 수정해주시면 좋을 것 같아요~!
문제 푸시느라 고생 많으셨습니다! 아이디어의 흐름을 주석으로 잘 남겨 주셔서 덕분에 풀이 이해하기도 수월했습니다 👍👍👍 남은 문제도 화이팅입니다!!
// 피보나치 수열 계산을 위한 변수 | ||
let first = 1; // f(0) = 1 | ||
let second = 1; // f(1) = 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.
저는 배열을 사용해서 모든 과정에서 나오는 값들을 다 저장했는데 이렇게 변수 2개만 사용하는 방법도 있네요!! 좋은 방법 배워갑니다 👍
// 길이가 다르면 애너그램이 될 수 없음 (빠른 리턴) | ||
if (s.length !== t.length) { | ||
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.
이렇게 빠르게 판단 가능한 경우에 바로 리턴해주는 것 좋은 것 같아요 👏
for (let count of charMap.values()) { | ||
if (count !== 0) { | ||
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.
동일한 방법이긴 한데 array의 내장 메서드인 every
를 사용하는 방법도 있어서 코멘트 남깁니다 😁
기존 코드와 비슷하게 조건에 맞지 않는 요소가 있으면 바로 false를 반환해서 성능적으로도 비슷할 것 같아요..!
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/every
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!