Skip to content

Conversation

yhkee0404
Copy link
Contributor

@yhkee0404 yhkee0404 commented Sep 11, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1 << 6 = 64개 만큼의 전처리 시간과 공간을 희생해서 추론 시간을 32번에서 6번으로 줄였습니다.
Bucket 또는 Square Root Decomposition이라고 할 수 있겠어요: https://github.com/DaleStudy/leetcode-study/pull/1792/files#r2265196896

@hu6r1s hu6r1s self-requested a review September 12, 2025 05:11
@yhkee0404 yhkee0404 moved this from Solving to In Review in 리트코드 스터디 5기 Sep 13, 2025
Copy link
Contributor Author

@yhkee0404 yhkee0404 Sep 13, 2025

Choose a reason for hiding this comment

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

부분 문자열 중 모든 Palindrome을 선형 시간에 구하는 Manacher's Algorithm입니다. 동일한 Palindrome이 중복 등장할 때는 DP를 통해 재사용합니다.
길이가 짝수인 Palindrome도 마치 길이가 홀수인 것처럼 처리할 수 있도록 Sentinel 값을 이용합니다.

Copy link
Contributor Author

@yhkee0404 yhkee0404 Sep 13, 2025

Choose a reason for hiding this comment

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

Dijkstra처럼 우선순위 큐와 Cache Validation을 이용한 O(nlogn) 풀이입니다.
n <= 10^5이므로 nlogn < 26n입니다.
선형 풀이와의 비교: 2bb561c

Copy link
Contributor Author

Choose a reason for hiding this comment

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

알고달레에서 감사하게도 선형 풀이를 배웠습니다.
다만 해당 풀이에서 Sliding Window의 끝점을 기준으로 시작점을 줄이는 것과 달리 저는 시작점을 기준으로 끝점을 늘려 봤습니다.
한편 해당 풀이 관련 개선점도 공유합니다: DaleSeo/AlgoDale#31
O(nlogn) 풀이와의 비교: 2bb561c

Copy link
Contributor

@hu6r1s hu6r1s left a comment

Choose a reason for hiding this comment

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

리뷰가 늦었네요..죄송합니다
언어를 다양하게 쓰실 줄.. 부럽습니다.
8주차 수고하셨어요~!

@yhkee0404 yhkee0404 merged commit 1de4014 into DaleStudy:main Sep 14, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 5기 Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants