-
-
Notifications
You must be signed in to change notification settings - Fork 245
[yhkee0404] WEEK 08 solutions #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 값을 이용합니다.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰가 늦었네요..죄송합니다
언어를 다양하게 쓰실 줄.. 부럽습니다.
8주차 수고하셨어요~!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!