Skip to content

[junzero741] WEEK 1 Solutions#2353

Merged
junzero741 merged 8 commits intoDaleStudy:mainfrom
junzero741:main
Mar 7, 2026
Merged

[junzero741] WEEK 1 Solutions#2353
junzero741 merged 8 commits intoDaleStudy:mainfrom
junzero741:main

Conversation

@junzero741
Copy link
Contributor

@junzero741 junzero741 commented Mar 2, 2026

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

const b = target - a;

if(complementMap.has(b)) {
return [complementMap.get(b) || -1, aIndex];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당부분은 위에서 has로 존재가 먼저 평가되어서 or로 null 체크를 안해도 될 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입을 좁히기 위해 사용했던 건데, 다시 생각해보니 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]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작은 부분이긴한데, map전에 slice를 하면 실행시간면에서 약간이라도 줄일 수 있을 것 같습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다시보니 그렇네요!! 감사합니다

@juhui-jeong juhui-jeong self-requested a review March 6, 2026 11:14
Copy link
Contributor

@juhui-jeong juhui-jeong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

각 문제 별 시간복잡도, 공간복잡도 작성해주신 것까지 잘 풀어주셨습니다.
다른 분꼐서 코멘트 남겨주신 부분 참고해주시면 좋을 것 같습니다.
아직 한 문제 남겨두셨지만 토요일에 병합되어야하기 때문에 우선 승인해놓겠습니다!
첫 주 고생 많으셨습니다~! 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아주 깔끔하네요. ㅎㅎ

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제 의도대로 잘 풀어주셨습니다!

@junzero741 junzero741 moved this from Solving to In Review in 리트코드 스터디 7기 Mar 7, 2026
@junzero741 junzero741 merged commit 7d1cde7 into DaleStudy:main Mar 7, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 7기 Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

3 participants