[junzero741] WEEK 1 Solutions#2353
Merged
junzero741 merged 8 commits intoDaleStudy:mainfrom Mar 7, 2026
Merged
Conversation
dohyeon2
reviewed
Mar 5, 2026
| const b = target - a; | ||
|
|
||
| if(complementMap.has(b)) { | ||
| return [complementMap.get(b) || -1, aIndex]; |
Contributor
There was a problem hiding this comment.
해당부분은 위에서 has로 존재가 먼저 평가되어서 or로 null 체크를 안해도 될 것 같습니다!
Contributor
Author
There was a problem hiding this comment.
타입을 좁히기 위해 사용했던 건데, 다시 생각해보니 for 문 안에서 아래와 같이 풀면 더 효율적이겠네요!
const bIndex = complementMap.get(b);
if(bIndex !== undefined) {
return [bIndex, aIndex];
}
| const sortedNumFrequencyKeysArr = | ||
| numFrequencyArr | ||
| .sort((a,b) => b[1]-a[1]) | ||
| .map((entry) => entry[0]); |
Contributor
There was a problem hiding this comment.
작은 부분이긴한데, map전에 slice를 하면 실행시간면에서 약간이라도 줄일 수 있을 것 같습니다
Contributor
Author
There was a problem hiding this comment.
다시보니 그렇네요!! 감사합니다
juhui-jeong
approved these changes
Mar 6, 2026
Contributor
juhui-jeong
left a comment
There was a problem hiding this comment.
각 문제 별 시간복잡도, 공간복잡도 작성해주신 것까지 잘 풀어주셨습니다.
다른 분꼐서 코멘트 남겨주신 부분 참고해주시면 좋을 것 같습니다.
아직 한 문제 남겨두셨지만 토요일에 병합되어야하기 때문에 우선 승인해놓겠습니다!
첫 주 고생 많으셨습니다~! 👍
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 하나 이상을 반드시 검토를 해주셔야 합니다!