Skip to content

Conversation

limlimjo
Copy link
Contributor

@limlimjo limlimjo commented Dec 16, 2024

답안 제출 문제

체크 리스트

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

@limlimjo limlimjo requested a review from a team as a code owner December 16, 2024 13:30
@github-actions github-actions bot added the js label Dec 16, 2024
@limlimjo limlimjo requested a review from Jeehay28 December 16, 2024 13:31
Comment on lines +25 to +26
while (low < high && nums[low] === nums[low + 1]) low++;
while (low < high && nums[high] === nums[high - 1]) high--;
Copy link
Contributor

Choose a reason for hiding this comment

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

맞아요 :) 전 문제의 핵심은 정렬, 투 포인터 를 극한의 효율로 사용하기 위한 25,26 라인의 while문인것 같습니다. 전 이 부분을 고려 안해서 자꾸 실패했었네요 ㅎㅎ

Comment on lines +6 to +11
// 규칙성 찾기
// n = 1 -> 1 (1)
// n = 2 -> 2 (1+1, 2)
// n = 3 -> 2 + 1 = 3 (1+1+1, 1+2, 2+1)
// n = 4 -> 2 + 3 = 5 (1+1+1, 1+1+2, 1+2+1, 2+1+1, 2+2)
// n = 5 -> 3 + 5 = 8 (1+1+1+1+1, 1+1+1+2, 1+1+2+1, 1+2+1+1, 2+1+1+1, 1+2+2, 2+2+1, 2+1+2)
Copy link
Contributor

Choose a reason for hiding this comment

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

규칙성을 잘 찾으셔서 무리없이 풀으셨을것 같습니다!
이런 식의 규칙성 문제는 대부분 DP를 사용하는것 같아요!

Comment on lines +17 to +27
for (let i = 0; i < s.length; i++) {
countS[s[i]] = (countS[s[i]] || 0) + 1;
countT[t[i]] = (countT[t[i]] || 0) + 1;
}

// 두 객체 동일하면 true, 아니면 false
for (let char in countS) {
if (countS[char] !== countT[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.

같은 방법이긴 합니다만 count배열을 하나만 두고 같은 값이 s에 있으면 +, t에 있으면 -를 해주면 결국 해당 값이 0이 될거에요.
이때 두번째 for문에서 배열의 값이 모두 0이면 anagram이 성립하는 식으로 풀이 방법도 있습니다 :)

Copy link
Contributor

@TonyKim9401 TonyKim9401 left a comment

Choose a reason for hiding this comment

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

2주차 문제풀이 고생 많으셨습니다!
문제마다 풀이에 대해 고심하신 흔적을 볼 수 있어서 너무 좋았어요!
3주차도 파이팅입니다!

@limlimjo limlimjo merged commit e4bf20a into DaleStudy:main Dec 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants