[clara-shin] WEEK 02 solutions #1259
Merged
clara-shin merged 5 commits intoDaleStudy:mainfrom Apr 13, 2025
Merged
Conversation
yoouyeon
approved these changes
Apr 12, 2025
Comment on lines
+24
to
+26
| // 피보나치 수열 계산을 위한 변수 | ||
| let first = 1; // f(0) = 1 | ||
| let second = 1; // f(1) = 1 |
Contributor
There was a problem hiding this comment.
저는 배열을 사용해서 모든 과정에서 나오는 값들을 다 저장했는데 이렇게 변수 2개만 사용하는 방법도 있네요!! 좋은 방법 배워갑니다 👍
Comment on lines
+22
to
+25
| // 길이가 다르면 애너그램이 될 수 없음 (빠른 리턴) | ||
| if (s.length !== t.length) { | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
이렇게 빠르게 판단 가능한 경우에 바로 리턴해주는 것 좋은 것 같아요 👏
Comment on lines
+47
to
+51
| for (let count of charMap.values()) { | ||
| if (count !== 0) { | ||
| return false; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
동일한 방법이긴 한데 array의 내장 메서드인 every를 사용하는 방법도 있어서 코멘트 남깁니다 😁
기존 코드와 비슷하게 조건에 맞지 않는 요소가 있으면 바로 false를 반환해서 성능적으로도 비슷할 것 같아요..!
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/every
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!