[hi-rachel] WEEK 08 solutions#1895
Merged
hi-rachel merged 3 commits intoDaleStudy:mainfrom Sep 14, 2025
Merged
Conversation
printjin-gmailcom
approved these changes
Sep 11, 2025
| return max_len | ||
|
|
||
|
|
||
| from collections import Counter |
Contributor
There was a problem hiding this comment.
Counter 대신 dict를 써도 좋을 것 같아요
palindromic-substrings/hi-rachel.py
Outdated
| def countSubstrings(self, s: str) -> int: | ||
| count = 0 | ||
| for center in range(len(s)): | ||
| print(center) |
Contributor
There was a problem hiding this comment.
디버깅용이라면 삭제하거나 로깅 수준으로 조절 필요할 것 같습니다
| - 홀수 길이: center = 0 ~ n-1 (expand(i, i)) | ||
| - 짝수 길이: center = 0 ~ n-1 (expand(i, i+1)) | ||
|
|
||
| TC: O(N^2) |
Contributor
There was a problem hiding this comment.
시간 복잡도는 O(N^2)이 맞지만, 긴 문자열 입력에서는 최적화(예: DP 방식)도 고려 가능 할 것 같습니다
hyer0705
approved these changes
Sep 13, 2025
Contributor
There was a problem hiding this comment.
슬라이딩 윈도우 알고리즘을 사용하신 걸까요? 저도 비슷하게 풀이해서 코드를 이해하기 쉬웠습니다! l이나 r 이라는 변수명이 짧지만 가독성을 해치진 않네요!
Contributor
There was a problem hiding this comment.
모든 중심점에서 좌우로 확장하면서 하는 방법도 있다는 것을 배울 수 있었습니다. 저는 DP로 풀었는데 @hi-rachel 님이 풀이한 방법으로도 풀이를 해봐야겠네요!
Contributor
Author
감사합니다 !! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!