Skip to content

[Cyjin-jani] WEEK 02 solutions #2398

Merged
Cyjin-jani merged 5 commits intoDaleStudy:mainfrom
Cyjin-jani:main
Mar 13, 2026
Merged

[Cyjin-jani] WEEK 02 solutions #2398
Cyjin-jani merged 5 commits intoDaleStudy:mainfrom
Cyjin-jani:main

Conversation

@Cyjin-jani
Copy link
Contributor

@Cyjin-jani Cyjin-jani commented Mar 9, 2026

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Copy link
Contributor

@dohyeon2 dohyeon2 left a comment

Choose a reason for hiding this comment

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

고민이 많이 느껴지는 좋은 풀이같습니다.
많이 배웠습니다

@@ -0,0 +1,19 @@
// tc: O(n)
// sc: 제약조건에 따르면 O(1). 그러나 모든 유니코드 포함될 경우 O(n)
Copy link
Contributor

Choose a reason for hiding this comment

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

혹시 유니코드 포함 상황에서 O(n)인 이유를 알 수 있을까요? 모르는 부분이라 여쭙니다! 해시맵 구조를 고려하신걸까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아..! 이 부분은 저도 정확히 몰라서 ai에게 물어봐서 알게 된 내용이긴 합니다.. 근데 설명 들어보니 그럴듯해서 적게 되었어요!

유니코드는 한자, 특수기호, 이모지 등 14만 개가 넘어서 사실상 종류가 무한대에 가깝습니다. 만약 길이가 1,000(n=1000)인 문자열이 들어왔는데, 1,000글자가 전부 다 다르게 생긴 이모지라면 중복이 하나도 없으니 Map 안에도 데이터가 정확히 1,000개 생기게 됩니다. 즉, 최악의 경우 문자열의 길이(n)가 길어지는 만큼 Map에 쌓이는 데이터 개수도 똑같이 커지기 때문에 공간 복잡도가 O(n)이 됩니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

상세한 설명 감사합니다

}

for (let char of t) {
if (!data.get(char)) return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

0도 false로 처리되어 작동하는군요.
t가 모자랄수도 있지 않나? 라는 생각도 해보았는데,
같은 길이를 가정할 때 어떤 철자에선 반드시 t가 더 많을 수 밖에 없다는 걸 깨닫고 납득했습니다.
리팩토링의 흔적이 느껴지는 코드네요

Copy link
Contributor

@ppxyn1 ppxyn1 left a comment

Choose a reason for hiding this comment

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

2주차도 고생하셨습니다.

const answer = [];

// 먼저 오름차순 정렬하기
const sortedArr = nums.sort((a, b) => a - b);
Copy link
Contributor

Choose a reason for hiding this comment

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

소팅+투 포인터 방식으로 잘 해결하신 것 같습니다. 저도 처음에 풀이 영상을 보면서 풀었었는데, 이번에 다시 볼때에는 어떻게 풀어야할지 기억이 나더라고요. 작성해 주신것 처럼 도움을 받아 구현해보면서 정리해 보는 과정도 좋은 것 같습니다.

@Cyjin-jani Cyjin-jani moved this from Solving to In Review in 리트코드 스터디 7기 Mar 13, 2026
@Cyjin-jani Cyjin-jani merged commit 81ca178 into DaleStudy:main Mar 13, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 7기 Mar 13, 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